mirror of
https://github.com/nova-r/fediplug.git
synced 2025-03-10 07:39:00 +01:00
fix tests broken by modularization
This commit is contained in:
parent
e0a8c58476
commit
2a683ced56
2 changed files with 6 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,5 +4,6 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
*.secret
|
*.secret
|
||||||
.cache
|
.cache
|
||||||
|
.pytest_cache
|
||||||
.vscode
|
.vscode
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
from os import environ
|
from os import environ
|
||||||
|
|
||||||
import fediplay
|
from fediplay.mastodon import extract_links
|
||||||
|
from fediplay.queue import build_play_command
|
||||||
|
|
||||||
def test_extract_links():
|
def test_extract_links():
|
||||||
toot = {
|
toot = {
|
||||||
'content': "<p><a href=\"https://cybre.space/tags/nowplaying\" class=\"mention hashtag\" rel=\"tag\">#<span>nowplaying</span></a> <a href=\"https://cybre.space/tags/fediplay\" class=\"mention hashtag\" rel=\"tag\">#<span>fediplay</span></a> Grimes ft. Janelle Mon\u00e1e - Venus Fly <a href=\"https://www.youtube.com/watch?v=eTLTXDHrgtw\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"ellipsis\">youtube.com/watch?v=eTLTXDHrgt</span><span class=\"invisible\">w</span></a></p>"
|
'content': "<p><a href=\"https://cybre.space/tags/nowplaying\" class=\"mention hashtag\" rel=\"tag\">#<span>nowplaying</span></a> <a href=\"https://cybre.space/tags/fediplay\" class=\"mention hashtag\" rel=\"tag\">#<span>fediplay</span></a> Grimes ft. Janelle Mon\u00e1e - Venus Fly <a href=\"https://www.youtube.com/watch?v=eTLTXDHrgtw\" rel=\"nofollow noopener\" target=\"_blank\"><span class=\"invisible\">https://www.</span><span class=\"ellipsis\">youtube.com/watch?v=eTLTXDHrgt</span><span class=\"invisible\">w</span></a></p>"
|
||||||
}
|
}
|
||||||
urls = fediplay.extract_links(toot)
|
urls = extract_links(toot)
|
||||||
assert urls == ['https://www.youtube.com/watch?v=eTLTXDHrgtw']
|
assert urls == ['https://www.youtube.com/watch?v=eTLTXDHrgtw']
|
||||||
|
|
||||||
def test_build_play_command_default():
|
def test_build_play_command_default():
|
||||||
environ.pop('FEDIPLAY_PLAY_COMMAND')
|
environ.pop('FEDIPLAY_PLAY_COMMAND')
|
||||||
play_command = fediplay.build_play_command('Awesome Music.mp3')
|
play_command = build_play_command('Awesome Music.mp3')
|
||||||
assert play_command == 'ffplay -v 0 -nostats -hide_banner -autoexit -nodisp \'Awesome Music.mp3\''
|
assert play_command == 'ffplay -v 0 -nostats -hide_banner -autoexit -nodisp \'Awesome Music.mp3\''
|
||||||
|
|
||||||
def test_build_play_command_specified():
|
def test_build_play_command_specified():
|
||||||
environ.update(FEDIPLAY_PLAY_COMMAND='afplay {filename}')
|
environ.update(FEDIPLAY_PLAY_COMMAND='afplay {filename}')
|
||||||
play_command = fediplay.build_play_command('Awesome Music.mp3')
|
play_command = build_play_command('Awesome Music.mp3')
|
||||||
assert play_command == 'afplay \'Awesome Music.mp3\''
|
assert play_command == 'afplay \'Awesome Music.mp3\''
|
||||||
|
|
Loading…
Reference in a new issue