How to use the pysmartthings.app.AppSettingsEntity 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_save_no_app_id(api):
        """Tests save when there's no app id."""
        # Arrange
        settings = AppSettingsEntity(api, None)
        # Act/Assert
        with pytest.raises(ValueError):
            await settings.save()
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
async def test_refresh(api):
        """Tests data is refreshed."""
        # Arrange
        data = {'settings': {'test2': 'test'}}
        settings = AppSettingsEntity(api, APP_ID, data)
        # Act
        await settings.refresh()
        # Assert
        assert settings.settings == {'test': 'test'}
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
async def test_refresh_no_app_id(api):
        """Tests refresh when there's no app id."""
        # Arrange
        settings = AppSettingsEntity(api, None)
        # Act/Assert
        with pytest.raises(ValueError):
            await settings.refresh()
github andrewsayre / pysmartthings / tests / test_app.py View on Github external
async def test_save(api):
        """Tests the save function."""
        # Arrange
        data = {'settings': {'test': 'test'}}
        settings = AppSettingsEntity(api, APP_ID, data)
        # Act
        await settings.save()
        # Assert
        assert settings.settings == {'test': 'test'}
github andrewsayre / pysmartthings / pysmartthings / smartthings.py View on Github external
async def update_app_settings(self, data: AppSettings) -> AppSettingsEntity:
        """Update an app's settings."""
        entity = await self._service.update_app_settings(data.app_id, data.to_data())
        return AppSettingsEntity(self._service, data.app_id, entity)
github andrewsayre / pysmartthings / pysmartthings / smartthings.py View on Github external
async def app_settings(self, app_id: str) -> AppSettingsEntity:
        """Get an app's settings."""
        settings = await self._service.get_app_settings(app_id)
        return AppSettingsEntity(self._service, app_id, settings)
github andrewsayre / pysmartthings / pysmartthings / app.py View on Github external
async def settings(self) -> AppSettingsEntity:
        """Get the app's settings."""
        entity = await self._api.get_app_settings(self._app_id)
        return AppSettingsEntity(self._api, self._app_id, entity)