The CI got different Spotify IDs to my computer. Generalise the tests. For #74.

This commit is contained in:
hugovk 2014-03-05 00:51:20 +02:00
parent 3d169178ae
commit 2a48ccf369

View file

@ -1022,9 +1022,8 @@ class TestPyLast(unittest.TestCase):
# Assert # Assert
self.assertEqual(type(links), list) self.assertEqual(type(links), list)
self.assertEqual(len(links), 2) self.assertEqual(len(links), 2)
# How permanent are Spotify IDs? If they change, make tests more robust self.assertIn("spotify:album:", links[0])
self.assertEqual(links[0], "spotify:album:3gxOtUSRzweDWBKlpj7cG6") self.assertIn("spotify:album:", links[1])
self.assertEqual(links[1], "spotify:album:2fGCAYUMssLKiUAoNdxGLx")
def test_get_artist_play_links(self): def test_get_artist_play_links(self):
@ -1036,9 +1035,8 @@ class TestPyLast(unittest.TestCase):
# Assert # Assert
self.assertEqual(type(links), list) self.assertEqual(type(links), list)
self.assertEqual(len(links), 2) self.assertEqual(len(links), 2)
# How permanent are Spotify IDs? If they change, make tests more robust self.assertIn("spotify:artist:", links[0])
self.assertEqual(links[0], "spotify:artist:6liAMWkVf5LH7YR9yfFy1Y") self.assertIn("spotify:artist:", links[1])
self.assertEqual(links[1], "spotify:artist:4Z8W4fKeB5YxbusRsdQVPb")
def test_get_track_play_links(self): def test_get_track_play_links(self):
@ -1053,9 +1051,9 @@ class TestPyLast(unittest.TestCase):
# Assert # Assert
self.assertEqual(type(links), list) self.assertEqual(type(links), list)
self.assertEqual(len(links), 2) self.assertEqual(len(links), 2)
# How permanent are Spotify IDs? If they change, make tests more robust # How permanent are spotify IDs? If they change, make tests more robust
self.assertEqual(links[0], "spotify:track:2bt04YlMnqiwA3T6O9UqBO") self.assertIn("spotify:track:", links[0])
self.assertEqual(links[1], "spotify:track:0KYHSg38GsU1naJ5jh1llP") self.assertIn("spotify:track:", links[1])
if __name__ == '__main__': if __name__ == '__main__':