How to use the tekore.config_from_file function in tekore

To help you get started, we’ve selected a few tekore 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 felix-hilden / spotipy / tests / config.py View on Github external
def test_file_pathlib_path_accepted(self, conf_path):
        from pathlib import Path
        path = Path(conf_path)
        conf = config_from_file(path)
        assert conf == ('df_id', 'df_secret', 'df_uri')
github felix-hilden / spotipy / tests / config.py View on Github external
def test_config_written_with_tuple_refresh_token(self, conf_path):
        written = ('id', 'secret', 'uri', 'refresh')
        config_to_file(conf_path, written)
        loaded = config_from_file(conf_path, return_refresh=True)
        assert written == loaded
github felix-hilden / spotipy / tests / config.py View on Github external
def test_file_another_section_is_case_sensitive(self, conf_path):
        config_names_set(
            'client_id',
            'client_secret',
            'redirect_uri',
            '_'
        )
        with handle_warnings('ignore'):
            conf = config_from_file(conf_path)
        assert conf == (None, None, None)
github felix-hilden / spotipy / tests / config.py View on Github external
def test_file_missing_variables_returns_none(self, conf_path):
        config_names_set(
            'CLIENT_ID',
            'CLIENT_SECRET',
            'REDIRECT_URI',
            '_'
        )
        with handle_warnings('ignore'):
            conf = config_from_file(conf_path, 'MISSING')
        assert conf == (None, None, None)
github felix-hilden / spotipy / tests / config.py View on Github external
def test_config_write_to_section(self, conf_path):
        written = ('id', 'secret', 'uri')
        config_to_file(conf_path, written, section='SEC')
        loaded = config_from_file(conf_path, section='SEC')
        assert written == loaded
github felix-hilden / spotipy / tests / config.py View on Github external
def test_missing_variables_warned(self, conf_path):
        config_names_set(
            'CLIENT_ID',
            'CLIENT_SECRET',
            'REDIRECT_URI',
            '_'
        )
        with handle_warnings('error'):
            with pytest.raises(MissingConfigurationWarning):
                config_from_file(conf_path, 'MISSING')
github felix-hilden / spotipy / tests / config.py View on Github external
def test_file_refresh_returned(self, conf_path):
        conf = config_from_file(conf_path, return_refresh=True)
        assert conf == ('df_id', 'df_secret', 'df_uri', 'df_refresh')
github felix-hilden / spotipy / tests / config.py View on Github external
def test_config_tuple_nones_not_written(self, conf_path):
        original = ('id', 'secret', 'uri')
        config_to_file(conf_path, original)

        written = (None, 'another', None)
        config_to_file(conf_path, written)

        loaded = config_from_file(conf_path)
        assert ('id', 'another', 'uri') == loaded
github felix-hilden / spotipy / tests / config.py View on Github external
def test_config_written_with_tuple(self, conf_path):
        written = ('id', 'secret', 'uri')
        config_to_file(conf_path, written)
        loaded = config_from_file(conf_path)
        assert written == loaded
github felix-hilden / spotipy / tests / config.py View on Github external
def test_file_nonexistent_file_raises(self):
        with pytest.raises(FileNotFoundError):
            config_from_file('not_file.ini')