summaryrefslogtreecommitdiff
path: root/tests/models/track_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/models/track_test.py')
-rw-r--r--tests/models/track_test.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/models/track_test.py b/tests/models/track_test.py
index 56685fd..2bb4df1 100644
--- a/tests/models/track_test.py
+++ b/tests/models/track_test.py
@@ -4,14 +4,14 @@ from models.track import Track
def test_instance(database):
- track = Track(id=1, db=database)
+ track = Track(database, 1)
assert track.id == 1
assert track.name == "Non album track"
assert track.filename == "1.mp3"
-
+ assert track.artists
def test_as_dict(database):
- track = Track(id=1, db=database)
+ track = Track(database, 1)
track_dict = track.as_dict()
@@ -22,35 +22,35 @@ def test_as_dict(database):
def test_album(database):
- track1 = Track(id=1, db=database)
+ track1 = Track(database, 1)
assert track1.album is None
- track2 = Track(id=2, db=database)
+ track2 = Track(database, 2)
assert track2.album.name == "Album 1"
assert track2.album.date == "1999-02-04"
def test_artists(database):
- track = Track(id=1, db=database)
- assert track.artists is not None
- assert len(track.artists) > 0
+ track = Track(database, 1)
+ assert track.artists
assert track.artists[0].name == "Artist 1"
def test_find_by_path(database):
- track1 = Track.find_by_path("album/2.mp3", db=database)
+ track1 = Track.find_by_path("album/2.mp3", database)
assert track1.filename == "album/2.mp3"
assert track1.name == "Album track 2"
assert track1.grouping == "swing"
+ assert track1.artists
nonexistent_track = Track.find_by_path("path/does/not/exist.mp3",
- db=database)
+ database)
assert nonexistent_track is None
def test_search(database):
- tracks = Track.search(db=database, name={"data": "Album track %",
- "operator": "LIKE"})
+ tracks = Track.search(database, name={"data": "Album track %",
+ "operator": "LIKE"})
assert tracks is not None
assert len(tracks) == 2
@@ -59,7 +59,7 @@ def test_search(database):
def test_store(database, test_file):
metadata = mutagen.File(test_file, easy=True)
- test_track = Track.store(test_file, metadata, db=database)
+ test_track = Track.store(test_file, metadata, database)
assert test_track.filename == test_file
assert test_track.name == "Silence"
@@ -76,7 +76,7 @@ def test_store(database, test_file):
def test_update(database, test_file):
metadata = {"artist": ["New artist"], "title": ["New title"]}
- test_track = Track.find_by_path(test_file, db=database)
+ test_track = Track.find_by_path(test_file, database)
test_track.update(metadata)
assert test_track.artists
@@ -86,21 +86,21 @@ def test_update(database, test_file):
def test_save(database, test_file):
- test_track = Track.find_by_path(test_file, db=database)
+ test_track = Track.find_by_path(test_file, database)
test_track.name = "Totally new name"
test_track.save()
- new_track_to_test = Track.find_by_path(test_file, db=database)
+ new_track_to_test = Track.find_by_path(test_file, database)
assert new_track_to_test.name == "Totally new name"
def test_delete(database, test_file):
- test_track = Track.find_by_path(test_file, db=database)
+ test_track = Track.find_by_path(test_file, database)
test_track.delete()
- should_not_exist = Track.find_by_path(test_file, db=database)
+ should_not_exist = Track.find_by_path(test_file, database)
assert should_not_exist is None