Ejemplo n.º 1
0
 def test_get_config_from_single_file(self, home_dir):
     # configs can be read from a file
     conf_path = home_dir / 'config.conf'
     conf_path.write('[DEFAULT]\nfpscan_path=some_value\n')
     conf = get_config(path=str(conf_path))
     assert conf.get('DEFAULT', 'fpscan_path') == 'some_value'
     assert conf.get('DEFAULT', 'waeup_url') == 'localhost:8080'
Ejemplo n.º 2
0
 def test_get_config_from_single_file(self, home_dir):
     # configs can be read from a file
     conf_path = home_dir / 'config.conf'
     conf_path.write('[DEFAULT]\nwaeup_user=user1\n')
     conf = get_config(path=str(conf_path))
     assert conf.get('DEFAULT', 'waeup_user') == 'user1'
     assert conf.get('DEFAULT', 'waeup_passwd') == 'grok'
Ejemplo n.º 3
0
 def test_all_conf_keys_appear(self, home_dir):
     # make sure that normally CONF_KEYS appear in default config
     conf = get_config()
     conf_dict = dict(conf.defaults())
     for key in CONF_KEYS:
         # some keys are not neccessarily available...
         if key in ['fpscan_path', ]:
             continue
         assert key in conf_dict
Ejemplo n.º 4
0
 def test_all_conf_keys_appear(self, home_dir):
     # make sure that normally CONF_KEYS appear in default config
     conf = get_config()
     conf_dict = dict(conf.defaults())
     for key in CONF_KEYS:
         # some keys are not neccessarily available...
         if key in ['fpscan_path', ]:
             continue
         assert key in conf_dict
Ejemplo n.º 5
0
 def test_get_config(self):
     # we can get valid configs
     conf = get_config()
     assert conf.get('DEFAULT', 'waeup_user') == 'grok'
     assert conf.get('DEFAULT', 'waeup_passwd') == 'grok'
     assert conf.get('DEFAULT', 'waeup_url') == 'localhost:8080'
Ejemplo n.º 6
0
 def test_get_config_fpscan_path(self, home_dir):
     # we get a valid fpscan path if avail.
     fake_fpscan = home_dir / "fpscan"
     fake_fpscan.write('Just a fake script.')
     conf = get_config()
     assert conf.get('DEFAULT', 'fpscan_path') == str(fake_fpscan)
Ejemplo n.º 7
0
 def test_get_url_from_config_with_paths(self):
     # app paths are taken into account
     config = get_config(path=None)
     config["DEFAULT"]["waeup_url"] = "http://sample.org/app"
     assert get_url_from_config(config) == (
         "http://*****:*****@sample.org/app")
Ejemplo n.º 8
0
 def test_get_url_from_config_changed_creds(self):
     # changed credentials are respected
     config = get_config(path=None)
     config["DEFAULT"]["waeup_user"] = "******"
     config["DEFAULT"]["waeup_passwd"] = "bar"
     assert get_url_from_config(config) == "https://*****:*****@localhost:8080"
Ejemplo n.º 9
0
 def test_get_url_from_config_w_scheme(self):
     # a scheme set in waeup_url will be respected
     config = get_config(path=None)
     config["DEFAULT"]["waeup_url"] = "http://sample.org"
     assert get_url_from_config(config) == (
         "http://*****:*****@sample.org")
Ejemplo n.º 10
0
 def test_get_url_from_config(self):
     # we can get valid XMLRPCable URLs from default config
     config = get_config(path=None)  # get default config
     assert get_url_from_config(config) == (
         "https://*****:*****@localhost:8080")
Ejemplo n.º 11
0
 def test_get_config(self):
     # we can get valid configs
     conf = get_config()
     assert conf.get('DEFAULT', 'waeup_url') == 'localhost:8080'
Ejemplo n.º 12
0
 def test_get_config_from_single_file_overwrites(self, home_dir):
     # configs can be read from a file, its values overwrite existing ones
     conf_path = home_dir / 'config.conf'
     conf_path.write('[DEFAULT]\nwaeup_url=otherhost:8181\n')
     conf = get_config(path=str(conf_path))
     assert conf.get('DEFAULT', 'waeup_url') == 'otherhost:8181'
Ejemplo n.º 13
0
 def test_get_config_fpscan_path(self, home_dir):
     # we get a valid fpscan path if avail.
     fake_fpscan = home_dir / "fpscan"
     fake_fpscan.write('Just a fake script.')
     conf = get_config()
     assert conf.get('DEFAULT', 'fpscan_path') == str(fake_fpscan)