diff --git a/tests/test__cd.py b/tests/test__cd.py index 90eb33f..7954a98 100644 --- a/tests/test__cd.py +++ b/tests/test__cd.py @@ -1,3 +1,5 @@ +import pytest + from scrobble.musicbrainz import CD, UserAgent, init_musicbrainz import importlib.metadata @@ -8,14 +10,25 @@ ) init_musicbrainz(USERAGENT) -test_cd = CD.find_cd(7277017746006, choice=False) +TEST_CD = CD.find_cd(7277017746006, choice=False) def test_cd_artist(): - assert test_cd.artist == 'Lacuna Coil' + assert TEST_CD.artist == 'Lacuna Coil' + def test_cd_album(): - assert test_cd.title == 'Comalies' + assert TEST_CD.title == 'Comalies' + def test_cd_track_length(): - assert len(test_cd) == 14 \ No newline at end of file + assert len(TEST_CD) == 14 + + +def test_cd_string_representation(): + assert str(TEST_CD) == "💿 Lacuna Coil - Comalies (2002)" + + +def test_failed_CD_retrieval(): + with pytest.raises(RuntimeError): + CD.find_cd(12345) diff --git a/tests/test__pushover.py b/tests/test__pushover.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test__utils.py b/tests/test__utils.py index f51cb8f..d4016b4 100644 --- a/tests/test__utils.py +++ b/tests/test__utils.py @@ -28,6 +28,10 @@ def test_valid_config_lastfm_username(): test_config = Config(config_path='tests/resources/scrobble_complete_valid.toml') assert test_config.lastfm_username == 'thespeckofme' +def test_valid_config_pushover_token(): + test_config = Config(config_path='tests/resources/scrobble_complete_valid.toml') + assert test_config.pushover_token == 'fakepushovertoken' + def test_find_command_succeeding(): command_check = find_command('ls') assert command_check is not None