added simple unit tests for pypo.

This commit is contained in:
mkonecny 2010-12-15 16:38:38 -05:00
parent 1b3186af50
commit d7c0f5cc15
4 changed files with 36 additions and 12 deletions

24
pypo/pypo-api-validator.py Normal file → Executable file
View file

@ -45,6 +45,30 @@ class TestApiFunctions(unittest.TestCase):
def test_is_server_compatible(self):
self.assertTrue(self.api_client.is_server_compatible(False))
def test_get_schedule(self):
status, response = self.api_client.get_schedule()
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("playlists"))
self.assertTrue(response.has_key("check"))
self.assertTrue(status == 1)
def test_get_media(self):
self.assertTrue(True)
def test_notify_scheduled_item_start_playing(self):
arr = dict()
arr["x"] = dict()
arr["x"]["schedule_id"]=1
response = self.api_client.notify_scheduled_item_start_playing("x", arr)
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("message"))
def test_notify_media_item_start_playing(self):
response = self.api_client.notify_media_item_start_playing('{"schedule_id":1}', 5)
self.assertTrue(response.has_key("status"))
self.assertTrue(response.has_key("message"))
if __name__ == '__main__':
unittest.main()