예제 #1
0
파일: api.py 프로젝트: KapJI/ha-google-home
    async def async_get_master_token(self) -> str:
        """Get master API token"""
        def _get_master_token() -> Optional[str]:
            return self._client.get_master_token()

        master_token = await self.hass.async_add_executor_job(_get_master_token
                                                              )
        if master_token is None or is_aas_et(master_token) is False:
            raise InvalidMasterToken
        return master_token
예제 #2
0
    async def async_get_master_token(self):
        """Get master API token"""
        def _get_master_token():
            return self._client.get_master_token()

        master_token = await self.hass.async_add_executor_job(_get_master_token
                                                              )
        if is_aas_et(master_token) is False:
            raise InvalidMasterToken
        return master_token
예제 #3
0
 def assertIsAasEt(self, variable: str) -> None:
     """Assert the given variable is a of string type and follows AAS token format"""
     self.assertTrue(
         token_utils.is_aas_et(variable),
         msg=f"Given variable {variable} doesn't follow the AAS_ET format",
     )
예제 #4
0
 def assertIsAASET(self, variable):
     self.assertTrue(
         type(variable) == str and token_utils.is_aas_et(variable),
         msg=f"Given variable {variable} doesn't follow the AAS_ET format",
     )