X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=tests%2Ftest_simadb.py;fp=tests%2Ftest_simadb.py;h=3be8758bf4448b17b6eca3ef8853761a9d4bbff3;hb=5cbf72d42c713c5a719fa407e6969f0a84fdfe21;hp=52e3e4409a53e36b088f13a7ce3075f9355cb243;hpb=c23e4560ba184403e94d41cbf0816ed9847406fc;p=mpd-sima.git diff --git a/tests/test_simadb.py b/tests/test_simadb.py index 52e3e44..3be8758 100644 --- a/tests/test_simadb.py +++ b/tests/test_simadb.py @@ -14,6 +14,7 @@ DEVOLT = { 'albumartist': 'Devolt', 'albumartistsort': 'Devolt', 'artist': 'Devolt', + 'genre': ['Rock'], 'date': '2011-12-01', 'disc': '1/1', 'file': 'music/Devolt/2011-Grey/03-Devolt - Crazy.mp3', @@ -97,7 +98,8 @@ class Test_00DB(Main): # recent first, oldest last hist = list() for i in range(1, 5): # starts at 1 to ensure records are in the past - trk = Track(file=f'/foo/bar.{i}', name='{i}-baz', album='foolbum') + trk = Track(file=f'/foo/bar.{i}', name=f'{i}-baz', + album='foolbum', genre=f'{i}') hist.append(trk) last = CURRENT - datetime.timedelta(minutes=i) self.db.add_history(trk, date=last) @@ -305,5 +307,20 @@ class Test_01BlockList(Main): conn.close() +class Test_02Genre(Main): + + def test_genre(self): + conn = self.db.get_database_connection() + self.db.get_genre('Post-Rock', with_connection=conn) + genres = list() + for i in range(1, 15): # starts at 1 to ensure records are in the past + trk = Track(file=f'/foo/bar.{i}', name=f'{i}-baz', + album='foolbum', artist=f'{i}-art', genre=f'{i}') + genres.append(f'{i}') + last = CURRENT - datetime.timedelta(minutes=i) + self.db.add_history(trk, date=last) + genre_hist = self.db.fetch_genres_history(limit=10) + self.assertEqual([g[0] for g in genre_hist], genres[:10]) + # VIM MODLINE # vim: ai ts=4 sw=4 sts=4 expandtab fileencoding=utf8