Jiggle the tests to increase coverage a bit

This commit is contained in:
hugovk 2014-03-04 10:42:59 +02:00
parent 9edfcb5745
commit 1fc02a33c5
2 changed files with 14 additions and 6 deletions

View file

@ -641,7 +641,7 @@ class LastFMNetwork(_Network):
"'%s'" %self.username, "'%s'" %self.password_hash))) "'%s'" %self.username, "'%s'" %self.password_hash)))
def __str__(self): def __str__(self):
return "LastFM Network" return "Last.fm Network"
def get_lastfm_network(api_key="", api_secret="", session_key = "", username = "", password_hash = ""): def get_lastfm_network(api_key="", api_secret="", session_key = "", username = "", password_hash = ""):
""" """

View file

@ -221,7 +221,7 @@ class TestPyLast(unittest.TestCase):
# Arrange # Arrange
artist = "Test Artist" artist = "Test Artist"
title = "Test Title" title = "Test Title"
track = pylast.Track(artist, title, self.network) track = self.network.get_track(artist, title)
lastfm_user = self.network.get_user(self.username) lastfm_user = self.network.get_user(self.username)
# Act # Act
@ -390,7 +390,7 @@ class TestPyLast(unittest.TestCase):
def test_country_is_hashable(self): def test_country_is_hashable(self):
# Arrange # Arrange
country = pylast.Country("Italy", self.network) country = self.network.get_country("Italy")
# Act/Assert # Act/Assert
self.helper_is_thing_hashable(country) self.helper_is_thing_hashable(country)
@ -407,7 +407,7 @@ class TestPyLast(unittest.TestCase):
def test_group_is_hashable(self): def test_group_is_hashable(self):
# Arrange # Arrange
group = pylast.Group("Audioscrobbler Beta", self.network) group = self.network.get_group("Audioscrobbler Beta")
# Act/Assert # Act/Assert
self.helper_is_thing_hashable(group) self.helper_is_thing_hashable(group)
@ -680,7 +680,7 @@ class TestPyLast(unittest.TestCase):
artist = pylast.Artist("Test Artist", self.network) artist = pylast.Artist("Test Artist", self.network)
# Act # Act
bio = artist.get_bio_content() bio = artist.get_bio_content(language = "en")
# Assert # Assert
self.assertIsNotNone(bio) self.assertIsNotNone(bio)
@ -692,7 +692,7 @@ class TestPyLast(unittest.TestCase):
artist = pylast.Artist("Test Artist", self.network) artist = pylast.Artist("Test Artist", self.network)
# Act # Act
bio = artist.get_bio_summary() bio = artist.get_bio_summary(language = "en")
# Assert # Assert
self.assertIsNotNone(bio) self.assertIsNotNone(bio)
@ -747,6 +747,14 @@ class TestPyLast(unittest.TestCase):
self.assertGreaterEqual(len(wiki), 1) self.assertGreaterEqual(len(wiki), 1)
def test_lastfm_network_name(self):
# Act
name = str(self.network)
# Assert
self.assertEqual(name, "Last.fm Network")
if __name__ == '__main__': if __name__ == '__main__':
# For quick testing of a single case (eg. test = "test_scrobble") # For quick testing of a single case (eg. test = "test_scrobble")