Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
 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.'
Ejemplo n.º 4
0
 def test_short_url(self):
     config = Config('DEFAULT')
     assert config.short_url == 'https://redd.it'
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
0
 def test_custom__no_extra_values_set(self):
     config = Config('DEFAULT')
     assert config.custom == {}
Ejemplo n.º 7
0
 def test_custom__extra_values_set(self):
     config = Config('DEFAULT', user1='foo', user2='bar')
     assert config.custom == {'user1': 'foo', 'user2': 'bar'}
Ejemplo n.º 8
0
 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
Ejemplo n.º 9
0
 def test_unset_value_has_useful_string_representation(self):
     config = Config('DEFAULT', password=Config.CONFIG_NOT_SET)
     assert str(config.password) == 'NotSet'
Ejemplo n.º 10
0
 def test_short_url(self):
     config = Config("DEFAULT")
     assert config.short_url == "https://redd.it"
Ejemplo n.º 11
0
 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
Ejemplo n.º 12
0
 def test_custom__extra_values_set(self):
     config = Config("DEFAULT", user1="foo", user2="bar")
     assert config.custom == {"user1": "foo", "user2": "bar"}
Ejemplo n.º 13
0
 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
Ejemplo n.º 14
0
 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
Ejemplo n.º 15
0
 def test_store_json__false(self):
     for value in [False, 'False', 'other']:
         config = Config('DEFAULT', store_json=value)
         assert config.store_json is False