history: Cleanup history entry test

This commit is contained in:
Stein Magnus Jodal 2014-09-23 18:47:28 +02:00
parent 177f91fb27
commit 5a67339855

View File

@ -29,13 +29,15 @@ class PlaybackHistoryTest(unittest.TestCase):
self.assertEqual(self.history.size, 0)
def test_history_sanity(self):
def test_history_entry_contents(self):
track = self.tracks[0]
self.history.add(track)
stored_history = self.history.get_history()
track_ref = stored_history[0][1]
self.assertEqual(track_ref.uri, track.uri)
self.assertIn(track.name, track_ref.name)
if track.artists:
for artist in track.artists:
self.assertIn(artist.name, track_ref.name)
result = self.history.get_history()
(timestamp, ref) = result[0]
self.assertIsInstance(timestamp, int)
self.assertEqual(track.uri, ref.uri)
self.assertIn(track.name, ref.name)
for artist in track.artists:
self.assertIn(artist.name, ref.name)