from os import environ from fediplug.mastodon import extract_links from fediplug.queue import build_play_command def test_extract_links(): toot = { "content": '

Grimes ft. Janelle Mon\u00e1e - Venus Fly youtube.com/watch?v=eTLTXDHrgt

' } urls = extract_links(toot) assert urls == ["https://www.youtube.com/watch?v=eTLTXDHrgtw"] def test_build_play_command_default(): environ.pop("FEDIPLAY_PLAY_COMMAND") play_command = build_play_command("Awesome Music.mp3") assert ( play_command == "ffplay -v 0 -nostats -hide_banner -autoexit -nodisp 'Awesome Music.mp3'" ) def test_build_play_command_specified(): environ.update(FEDIPLAY_PLAY_COMMAND="afplay {filename}") play_command = build_play_command("Awesome Music.mp3") assert play_command == "afplay 'Awesome Music.mp3'"