def test_v6_empty_channels(self): V = 6 with requests_mock.Mocker() as m: get_response(m.get, V, "system", "1/system") for url in [ "system", "audio/volume", "channeldb/tv", "activities/tv" ]: get_response(m.get, V, url) tv = PhilipsTV(HOST) tv.update() self.assertIsNone(tv.channels) self.assertEquals(tv.sources, []) self.assertIsNotNone(tv.volume)
def test_v1(self): V = 1 with requests_mock.Mocker() as m: for url in [ "system", "audio/volume", "channels", "channels/current" ]: get_response(m.get, V, url) _, sources = get_response(m.get, V, "sources") _, source_id = get_response(m.get, V, "sources/current") tv = PhilipsTV(HOST) tv.update() self.assertIsNotNone(tv.channels) self.assertIsNotNone(tv.sources) self.assertEqual(tv.getSourceName(tv.source_id), sources[source_id["id"]]["name"]) self.assertIsNotNone(tv.volume)