Пример #1
0
 async def test_settings(api):
     """Tests the settings method."""
     # Arrange
     data = get_json("app_get.json")
     app = AppEntity(api, data)
     # Act
     settings = await app.settings()
     # Assert
     assert settings.settings == {"test": "test"}
Пример #2
0
 async def test_save(api):
     """Tests updating an entity."""
     # Arrange
     data = get_json("app_get.json")
     app = AppEntity(api, data)
     before = app.last_updated_date
     # Act
     await app.save()
     # Assert
     assert app.last_updated_date > before
Пример #3
0
 async def test_oauth(api):
     """Tests the oauth method."""
     # Arrange
     data = get_json("app_get.json")
     app = AppEntity(api, data)
     # Act
     oauth = await app.oauth()
     # Assert
     assert oauth.app_id == app.app_id
     assert oauth.client_name == "pysmartthings-test"
     assert oauth.scope == ["r:devices"]
Пример #4
0
 async def test_refresh(api):
     """Tests data is refreshed."""
     # Arrange
     data = get_json("apps.json")["items"][0]
     app = AppEntity(api, data)
     # Act
     await app.refresh()
     # Assert
     assert app.single_instance
     assert app.webhook_target_url == "https://homeassistant.sayre.net:8321/"
     assert app.webhook_public_key