How to use the tekore.util.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 / util.py View on Github external
def test_file_nonexistent_section_raises(self):
        with self.assertRaises(KeyError):
            config_from_file(self.test_config_path, 'NOTSECTION')
github felix-hilden / spotipy / tests / util.py View on Github external
def test_file_pathlib_path_accepted(self):
        from pathlib import Path
        path = Path(self.test_config_path)
        conf = config_from_file(path)
        self.assertTupleEqual(conf, ('df_id', 'df_secret', 'df_uri'))
github felix-hilden / spotipy / tests / util.py View on Github external
def test_config_written_with_tuple_refresh_token(self):
        written = ('id', 'secret', 'uri', 'refresh')
        config_to_file(self.test_config_path, written)
        loaded = config_from_file(self.test_config_path, return_refresh=True)
        self.assertTupleEqual(written, loaded)
github felix-hilden / spotipy / tests / util.py View on Github external
def test_file_another_section_is_case_sensitive(self):
        self._config_names_set(
            'client_id',
            'client_secret',
            'redirect_uri',
            '_'
        )
        with handle_warnings('ignore'):
            conf = config_from_file(self.test_config_path)
        self.assertTupleEqual(conf, (None, None, None))
github felix-hilden / spotipy / tests / util.py View on Github external
def test_config_tuple_nones_not_written(self):
        original = ('id', 'secret', 'uri')
        config_to_file(self.test_config_path, original)

        written = (None, 'another', None)
        config_to_file(self.test_config_path, written)

        loaded = config_from_file(self.test_config_path)
        self.assertTupleEqual(('id', 'another', 'uri'), loaded)
github felix-hilden / spotipy / tests / util.py View on Github external
def test_config_write_to_section(self):
        written = ('id', 'secret', 'uri')
        config_to_file(self.test_config_path, written, section='SEC')
        loaded = config_from_file(self.test_config_path, section='SEC')
        self.assertTupleEqual(written, loaded)
github felix-hilden / spotipy / tests / util.py View on Github external
def test_config_written_with_dict(self):
        from tekore.util import config
        written = {config.client_secret_var: 'secret'}

        config_to_file(self.test_config_path, written)
        loaded = config_from_file(self.test_config_path)
        self.assertTupleEqual((None, 'secret', None), loaded)
github felix-hilden / spotipy / tests / util.py View on Github external
def test_file_default_section(self):
        conf = config_from_file(self.test_config_path)
        self.assertTupleEqual(conf, ('df_id', 'df_secret', 'df_uri'))
github felix-hilden / spotipy / tests / util.py View on Github external
def test_file_refresh_returned(self):
        conf = config_from_file(self.test_config_path, return_refresh=True)
        self.assertTupleEqual(conf, ('df_id', 'df_secret', 'df_uri', 'df_refresh'))
github felix-hilden / spotipy / tests / util.py View on Github external
def test_file_missing_variables_returns_none(self):
        self._config_names_set(
            'CLIENT_ID',
            'CLIENT_SECRET',
            'REDIRECT_URI',
            '_'
        )
        with handle_warnings('ignore'):
            conf = config_from_file(self.test_config_path, 'MISSING')
        self.assertTupleEqual(conf, (None, None, None))