Introduce new OAuth2 config flow helper (#27727)
* Refactor the Somfy auth implementation * Typing * Migrate Somfy to OAuth2 flow helper * Add tests * Add more tests * Fix tests * Fix type error * More tests * Remove side effect from constructor * implementation -> auth_implementation * Make get_implementation async * Minor cleanup + Allow picking implementations. * Add support for extra authorize data
This commit is contained in:
parent
6157be23dc
commit
b6c26cb363
15 changed files with 900 additions and 214 deletions
|
@ -1015,14 +1015,23 @@ def mock_entity_platform(hass, platform_path, module):
|
|||
hue.light.
|
||||
"""
|
||||
domain, platform_name = platform_path.split(".")
|
||||
integration_cache = hass.data.setdefault(loader.DATA_COMPONENTS, {})
|
||||
mock_platform(hass, f"{platform_name}.{domain}", module)
|
||||
|
||||
|
||||
def mock_platform(hass, platform_path, module=None):
|
||||
"""Mock a platform.
|
||||
|
||||
platform_path is in form hue.config_flow.
|
||||
"""
|
||||
domain, platform_name = platform_path.split(".")
|
||||
integration_cache = hass.data.setdefault(loader.DATA_INTEGRATIONS, {})
|
||||
module_cache = hass.data.setdefault(loader.DATA_COMPONENTS, {})
|
||||
|
||||
if platform_name not in integration_cache:
|
||||
mock_integration(hass, MockModule(platform_name))
|
||||
if domain not in integration_cache:
|
||||
mock_integration(hass, MockModule(domain))
|
||||
|
||||
_LOGGER.info("Adding mock integration platform: %s", platform_path)
|
||||
module_cache["{}.{}".format(platform_name, domain)] = module
|
||||
module_cache[platform_path] = module or Mock()
|
||||
|
||||
|
||||
def async_capture_events(hass, event_name):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue