Пример #1
0
 def test_get_default_settings_fpscan_found(self, home_dir):
     # we treat `fpscan_path` special and get a valid path.
     home_dir.join("fpscan").write("just a fake script")
     result = get_default_settings(
         [{'section': 'foo', 'key': 'fpscan_path', 'default': 'bar'}])
     path = str(home_dir / "fpscan")
     assert result == [("foo", dict(fpscan_path=path))]
Пример #2
0
 def test_get_default_settings_fpscan_found(self, home_dir):
     # we treat `fpscan_path` special and get a valid path.
     home_dir.join("fpscan").write("just a fake script")
     result = get_default_settings(
         [{'section': 'foo', 'key': 'fpscan_path', 'default': 'bar'}])
     path = str(home_dir / "fpscan")
     assert result == [("foo", dict(fpscan_path=path))]
Пример #3
0
 def test_get_default_settings_multi_in_section(self, home_dir):
     # we put several settings per section in one entry
     result = get_default_settings(
         [
             {'section': 'foo', 'key': 'key1', 'default': 'bar1'},
             {'section': 'foo', 'key': 'key2', 'default': 'bar2'}])
     assert result == [
         ("foo", dict(key1="bar1")), ("foo", dict(key2="bar2"))]
Пример #4
0
 def test_get_default_settings_multi_in_section(self, home_dir):
     # we put several settings per section in one entry
     result = get_default_settings(
         [
             {'section': 'foo', 'key': 'key1', 'default': 'bar1'},
             {'section': 'foo', 'key': 'key2', 'default': 'bar2'}])
     assert result == [
         ("foo", dict(key1="bar1")), ("foo", dict(key2="bar2"))]
Пример #5
0
 def test_get_default_settings_fpscan_not_found(self, home_dir):
     # we treat `fpscan_path` special.
     result = get_default_settings(
         [{'section': 'foo', 'key': 'fpscan_path', 'default': 'bar'}])
     assert result == [("foo", dict(fpscan_path="bar"))]
Пример #6
0
 def test_get_default_settings_ignore_no_default(self, home_dir):
     # we ignore settings w/o a default value
     result = get_default_settings([{'section': 'foo', 'key': 'bar'}])
     assert result == []
Пример #7
0
 def test_get_default_settings(self, home_dir):
     # we can get default of a single setting
     result = get_default_settings(
         [{'section': 'foo', 'key': 'bar', 'default': 'baz'}, ])
     assert result == [("foo", dict(bar="baz"))]
Пример #8
0
 def build_config(self, config):
     for key, conf_dict in get_default_settings():
         config.setdefaults(key, conf_dict)
Пример #9
0
 def build_config(self, config):
     for key, conf_dict in get_default_settings():
         config.setdefaults(key, conf_dict)
Пример #10
0
 def test_get_default_settings_fpscan_not_found(self, home_dir):
     # we treat `fpscan_path` special.
     result = get_default_settings(
         [{'section': 'foo', 'key': 'fpscan_path', 'default': 'bar'}])
     assert result == [("foo", dict(fpscan_path="bar"))]
Пример #11
0
 def test_get_default_settings_ignore_no_default(self, home_dir):
     # we ignore settings w/o a default value
     result = get_default_settings([{'section': 'foo', 'key': 'bar'}])
     assert result == []
Пример #12
0
 def test_get_default_settings(self, home_dir):
     # we can get default of a single setting
     result = get_default_settings(
         [{'section': 'foo', 'key': 'bar', 'default': 'baz'}, ])
     assert result == [("foo", dict(bar="baz"))]