Skip to content

Commit

Permalink
Add a couple of utils and cd tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
sheriferson committed Jan 19, 2024
1 parent d66a0e1 commit 822238a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tests/test__cd.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import pytest

from scrobble.musicbrainz import CD, UserAgent, init_musicbrainz

import importlib.metadata
Expand All @@ -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
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)
Empty file added tests/test__pushover.py
Empty file.
4 changes: 4 additions & 0 deletions tests/test__utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 822238a

Please sign in to comment.