SHARE
TWEET

Untitled

a guest Aug 13th, 2019 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## my test
  2.  
  3. async def test_setup_platform(hass, config_entry, config):
  4.     await setup_platform(hass, SWITCH_DOMAIN, config)
  5.     entity_registry = await hass.helpers.entity_registry.async_get_registry()
  6.     entry = entity_registry.async_get("switch.front_door_siren")
  7.     assert entry
  8.  
  9.  
  10. ## conftest.py
  11.  
  12. @pytest.fixture(name="config_entry")
  13. def config_entry_fixture():
  14.     """Create a mock ring config entry."""
  15.     return MockConfigEntry(domain=DOMAIN, data={CONF_USERNAME: 'foo',
  16.     CONF_PASSWORD: 'bar', CONF_SCAN_INTERVAL: 1000}, title='Ring')
  17.  
  18. @pytest.fixture(name="config")
  19. def config_fixture():
  20.     """Create hass config fixture."""
  21.     return {
  22.         DOMAIN: {CONF_USERNAME: 'foo',
  23.     CONF_PASSWORD: 'bar', CONF_SCAN_INTERVAL: 1000}
  24.     }
  25.  
  26. async def setup_platform(hass, platform,config):
  27.     """Set up the SmartThings platform and prerequisites."""
  28.     hass.config.components.add(DOMAIN)
  29.     assert await async_setup_component(hass, DOMAIN, config)
  30.     await hass.async_block_till_done()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top