All tests passing
This commit is contained in:
parent
805053b795
commit
fe660524a0
@ -130,8 +130,7 @@ class Notes(Base):
|
||||
note: str = Column(String(256), index=False)
|
||||
|
||||
def __init__(
|
||||
self, session: Session, playlist_id: int, row: int,
|
||||
text: str) -> None:
|
||||
self, session: Session, playlist_id: int, row: int, text: str) -> None:
|
||||
"""Create note"""
|
||||
|
||||
DEBUG(f"Notes.__init__({playlist_id=}, {row=}, {text=})")
|
||||
|
||||
@ -122,7 +122,7 @@ def test_playdates_add_playdate(session):
|
||||
track_path = "/a/b/c"
|
||||
track = Tracks(session, track_path)
|
||||
|
||||
playdate = Playdates(session, track)
|
||||
playdate = Playdates(session, track.id)
|
||||
assert playdate
|
||||
|
||||
last_played = Playdates.last_played(session, track.id)
|
||||
@ -136,7 +136,7 @@ def test_playdates_remove_track(session):
|
||||
track_path = "/a/b/c"
|
||||
track = Tracks(session, track_path)
|
||||
|
||||
playdate = Playdates(session, track)
|
||||
playdate = Playdates(session, track.id)
|
||||
Playdates.remove_track(session, track.id)
|
||||
|
||||
last_played = Playdates.last_played(session, track.id)
|
||||
@ -475,7 +475,7 @@ def test_tracks_update_lastplayed(session):
|
||||
track1 = Tracks(session, track1_path)
|
||||
|
||||
assert track1.lastplayed is None
|
||||
track1.update_lastplayed(session)
|
||||
track1.update_lastplayed(session, track1.id)
|
||||
assert track1.lastplayed is not None
|
||||
|
||||
|
||||
|
||||
@ -61,11 +61,9 @@ def test_save_and_restore(qtbot, session):
|
||||
# Add a track
|
||||
track_path = "/a/b/c"
|
||||
track = models.Tracks(session, track_path)
|
||||
# Inserting the track will also save the playlist
|
||||
playlist_tab.insert_track(session, track)
|
||||
|
||||
# Save playlist
|
||||
playlist_tab.save_playlist(session)
|
||||
|
||||
# We need to commit the session before re-querying
|
||||
session.commit()
|
||||
|
||||
@ -86,15 +84,20 @@ def test_meta_all_clear(qtbot, session):
|
||||
playlist_tab = playlists.PlaylistTab(None, session, playlist.id)
|
||||
|
||||
# Add some tracks
|
||||
# Need to commit session after each one so that new row is found
|
||||
# for subsequent inserts
|
||||
track1_path = "/a/b/c"
|
||||
track1 = models.Tracks(session, track1_path)
|
||||
playlist_tab.insert_track(session, track1)
|
||||
session.commit()
|
||||
track2_path = "/d/e/f"
|
||||
track2 = models.Tracks(session, track2_path)
|
||||
playlist_tab.insert_track(session, track2)
|
||||
session.commit()
|
||||
track3_path = "/h/i/j"
|
||||
track3 = models.Tracks(session, track3_path)
|
||||
playlist_tab.insert_track(session, track3)
|
||||
session.commit()
|
||||
|
||||
assert playlist_tab._get_current_track_row() is None
|
||||
assert playlist_tab._get_next_track_row() is None
|
||||
@ -113,12 +116,15 @@ def test_meta(qtbot, session):
|
||||
track1_path = "/a/b/c"
|
||||
track1 = models.Tracks(session, track1_path)
|
||||
playlist_tab.insert_track(session, track1)
|
||||
session.commit()
|
||||
track2_path = "/d/e/f"
|
||||
track2 = models.Tracks(session, track2_path)
|
||||
playlist_tab.insert_track(session, track2)
|
||||
session.commit()
|
||||
track3_path = "/h/i/j"
|
||||
track3 = models.Tracks(session, track3_path)
|
||||
playlist_tab.insert_track(session, track3)
|
||||
session.commit()
|
||||
|
||||
assert len(playlist_tab._get_unreadable_track_rows()) == 3
|
||||
|
||||
@ -191,9 +197,11 @@ def test_clear_next(qtbot, session):
|
||||
track1_path = "/a/b/c"
|
||||
track1 = models.Tracks(session, track1_path)
|
||||
playlist_tab.insert_track(session, track1)
|
||||
session.commit()
|
||||
track2_path = "/d/e/f"
|
||||
track2 = models.Tracks(session, track2_path)
|
||||
playlist_tab.insert_track(session, track2)
|
||||
session.commit()
|
||||
|
||||
playlist_tab._set_next_track_row(1)
|
||||
assert playlist_tab._get_next_track_row() == 1
|
||||
@ -216,9 +224,11 @@ def test_get_selected_row(qtbot, monkeypatch, session):
|
||||
track1_path = "/a/b/c"
|
||||
track1 = models.Tracks(session, track1_path)
|
||||
playlist_tab.insert_track(session, track1)
|
||||
session.commit()
|
||||
track2_path = "/d/e/f"
|
||||
track2 = models.Tracks(session, track2_path)
|
||||
playlist_tab.insert_track(session, track2)
|
||||
session.commit()
|
||||
|
||||
qtbot.addWidget(playlist_tab)
|
||||
with qtbot.waitExposed(window):
|
||||
@ -254,6 +264,7 @@ def test_set_next(qtbot, monkeypatch, session):
|
||||
assert track1_title
|
||||
|
||||
playlist_tab.insert_track(session, track1)
|
||||
session.commit()
|
||||
track2 = models.Tracks.get_by_filename(session, "mom.mp3")
|
||||
playlist_tab.insert_track(session, track2)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user