async def test_app_list(self): self.usecase.set_installed_apps({ TEST_APP: TEST_APP_NAME, TEST_APP2: TEST_APP_NAME2, }) apps = await self.atv.apps.app_list() expected_apps = [ App(TEST_APP_NAME, TEST_APP), App(TEST_APP_NAME2, TEST_APP2) ] assert not DeepDiff(expected_apps, apps)
async def test_app_list(companion_client, companion_usecase): companion_usecase.set_installed_apps({ TEST_APP: TEST_APP_NAME, TEST_APP2: TEST_APP_NAME2, }) apps = await companion_client.apps.app_list() expected_apps = [ App(TEST_APP_NAME, TEST_APP), App(TEST_APP_NAME2, TEST_APP2) ] assert not DeepDiff(expected_apps, apps)
def app(self) -> Optional[App]: """Return information about running app.""" player_path = self.psm.playing.player_path if player_path and player_path.client: return App(player_path.client.displayName, player_path.client.bundleIdentifier) return None
def app(self) -> Optional[App]: """Return information about running app.""" state = self.psm.playing if state.client: name = state.client.displayName or None return App(name, state.client.bundleIdentifier) return None
async def app_list(self) -> List[App]: """Fetch a list of apps that can be launched.""" app_list = await self.api.app_list() if "_c" not in app_list: raise exceptions.ProtocolError("missing content in response") content = cast(dict, app_list["_c"]) return [App(name, bundle_id) for bundle_id, name in content.items()]
def test_app_equality(): assert App(None, None) != "test" assert App(None, None) == App(None, None) assert App("test", None) != App(None, None) assert App("test", None) == App("test", None) assert App(None, "test") != App(None, None) assert App(None, "test") == App(None, "test") assert App("test", "test2") == App("test", "test2")
def app(self) -> Optional[App]: """Return information about running app.""" client = self.psm.client if client: return App(client.display_name, client.bundle_identifier) return None