Add test for storing album images on search

This commit is contained in:
Hugo 2018-04-14 22:38:43 +03:00
parent 971e4e3571
commit cf2d9113dd

View file

@ -315,6 +315,26 @@ class TestPyLastNetwork(PyLastTestCase):
self.assertIsInstance(results, list) self.assertIsInstance(results, list)
self.assertIsInstance(results[0], pylast.Album) self.assertIsInstance(results[0], pylast.Album)
def test_album_search_images(self):
# Arrange
album = "Nevermind"
search = self.network.search_for_album(album)
# Act
results = search.get_next_page()
images = results[0].images
# Assert
self.assertEqual(len(images), 4)
self.assertTrue(images[pylast.SIZE_SMALL].startswith("https://"))
self.assertTrue(images[pylast.SIZE_SMALL].endswith(".png"))
self.assertIn("/34s/", images[pylast.SIZE_SMALL])
self.assertTrue(images[pylast.SIZE_EXTRA_LARGE].startswith("https://"))
self.assertTrue(images[pylast.SIZE_EXTRA_LARGE].endswith(".png"))
self.assertIn("/300x300/", images[pylast.SIZE_EXTRA_LARGE])
def test_artist_search(self): def test_artist_search(self):
# Arrange # Arrange
artist = "Nirvana" artist = "Nirvana"