How to use the pysmartthings.app.AppEntity function in pysmartthings

To help you get started, we’ve selected a few pysmartthings examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewsayre / pysmartthings / tests / test_app.py View on Github external
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
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
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'}
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
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
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
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"]
github andrewsayre / pysmartthings / pysmartthings / smartthings.py View on Github external
async def create_app(self, app: App) -> (AppEntity, AppOAuthClient):
        """Create a new app."""
        entity = await self._service.create_app(app.to_data())
        return AppEntity(self._service, entity["app"]), AppOAuthClient(entity)
github andrewsayre / pysmartthings / pysmartthings / smartthings.py View on Github external
async def app(self, app_id: str) -> AppEntity:
        """Retrieve an app with the specified ID."""
        entity = await self._service.get_app(app_id)
        return AppEntity(self._service, entity)
github andrewsayre / pysmartthings / pysmartthings / smartthings.py View on Github external
    async def create_app(self, app: App) -> (AppEntity, AppOAuthClient):
        """Create a new app."""
        entity = await self._service.create_app(app.to_data())
        return AppEntity(self._service, entity["app"]), AppOAuthClient(entity)