def get_kind_mapping(): """ Get a mapping of kinds Returns: dict: A map of the kind name to the kind prefix (ie t1) """ return Config("DEFAULT").kinds
def test_extended_interpolation(self): Config.CONFIG = None # Force config file reload with mock.patch.dict( "os.environ", { "APPDATA": os.path.dirname(__file__), "XDG_CONFIG_HOME": os.path.dirname(__file__), }, ): config = Config("INTERPOLATION", config_interpolation="extended") assert config.custom["basic_interpolation"] == "%(reddit_url)s" assert config.custom["extended_interpolation"] == config.reddit_url
def test_short_url_not_defined(self): config = Config('DEFAULT', short_url=None) with pytest.raises(ClientException) as excinfo: config.short_url assert str(excinfo.value) == 'No short domain specified.'
def test_short_url(self): config = Config('DEFAULT') assert config.short_url == 'https://redd.it'
def test_check_for_updates__true(self): for value in [True, '1', 'true', 'YES', 'on']: config = Config('DEFAULT', check_for_updates=value) assert config.check_for_updates is True
def test_custom__no_extra_values_set(self): config = Config('DEFAULT') assert config.custom == {}
def test_custom__extra_values_set(self): config = Config('DEFAULT', user1='foo', user2='bar') assert config.custom == {'user1': 'foo', 'user2': 'bar'}
def test_check_for_updates__false(self): for value in [False, 'False', 'other']: config = Config('DEFAULT', check_for_updates=value) assert config.check_for_updates is False
def test_unset_value_has_useful_string_representation(self): config = Config('DEFAULT', password=Config.CONFIG_NOT_SET) assert str(config.password) == 'NotSet'
def test_short_url(self): config = Config("DEFAULT") assert config.short_url == "https://redd.it"
def test_check_for_updates__true(self): for value in [True, "1", "true", "YES", "on"]: config = Config("DEFAULT", check_for_updates=value) assert config.check_for_updates is True
def test_custom__extra_values_set(self): config = Config("DEFAULT", user1="foo", user2="bar") assert config.custom == {"user1": "foo", "user2": "bar"}
def test_check_for_updates__false(self): for value in [False, "False", "other"]: config = Config("DEFAULT", check_for_updates=value) assert config.check_for_updates is False
def test_store_json__true(self): for value in [True, '1', 'true', 'YES', 'on']: config = Config('DEFAULT', store_json=value) assert config.store_json is True
def test_store_json__false(self): for value in [False, 'False', 'other']: config = Config('DEFAULT', store_json=value) assert config.store_json is False