Add some Playlist tests

This commit is contained in:
hugovk 2014-03-17 22:48:08 +02:00
parent 7019b1b946
commit 862f7fe45c

View file

@ -1414,6 +1414,34 @@ class TestPyLast(unittest.TestCase):
self.network.disable_caching()
self.assertFalse(self.network.is_caching_enabled())
def test_create_playlist(self):
# Arrange
title = "Test playlist"
description = "Testing"
lastfm_user = self.network.get_user(self.username)
# Act
playlist = self.network.create_new_playlist(title, description)
# Assert
self.assertIsInstance(playlist, pylast.Playlist)
self.assertEqual(playlist.get_title(), "Test playlist")
self.assertEqual(playlist.get_description(), "Testing")
self.assertEqual(playlist.get_user(), lastfm_user)
def test_empty_playlist_unstreamable(self):
# Arrange
title = "Empty playlist"
description = "Unstreamable"
# Act
playlist = self.network.create_new_playlist(title, description)
# Assert
self.assertEqual(playlist.get_size(), 0)
self.assertEqual(playlist.get_duration(), 0)
self.assertFalse(playlist.is_streamable())
if __name__ == '__main__':
parser = argparse.ArgumentParser(