Separate Libre.fm test from Last.fm tests

This commit is contained in:
hugovk 2016-10-30 12:25:10 +02:00
parent ebee3f5568
commit 571edf23d9

View file

@ -375,21 +375,6 @@ class TestPyLast(unittest.TestCase):
self.assertEqual(str(current_track.title), "Test Title")
self.assertEqual(str(current_track.artist), "Test Artist")
@handle_lastfm_exceptions
def test_libre_fm(self):
# Arrange
username = self.__class__.secrets["username"]
password_hash = self.__class__.secrets["password_hash"]
# Act
network = pylast.LibreFMNetwork(
password_hash=password_hash, username=username)
tags = network.get_top_tags(limit=1)
# Assert
self.assertGreater(len(tags), 0)
self.assertIsInstance(tags[0], pylast.TopItem)
@handle_lastfm_exceptions
def test_album_tags_are_topitems(self):
# Arrange
@ -2175,5 +2160,26 @@ class TestPyLast(unittest.TestCase):
# Assert
self.assertEqual(mbid, None)
@flaky(max_runs=5, min_passes=1)
class TestPyLastWithLibreFm(unittest.TestCase):
"""Own class for Libre.fm because we don't need the Last.fm setUp"""
def test_libre_fm(self):
# Arrange
secrets = load_secrets()
username = secrets["username"]
password_hash = secrets["password_hash"]
# Act
network = pylast.LibreFMNetwork(
password_hash=password_hash, username=username)
tags = network.get_top_tags(limit=1)
# Assert
self.assertGreater(len(tags), 0)
self.assertIsInstance(tags[0], pylast.TopItem)
if __name__ == '__main__':
unittest.main(failfast=True)