예제 #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'
예제 #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'
예제 #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
예제 #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
예제 #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'
예제 #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)
예제 #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")
예제 #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"
예제 #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")
예제 #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")
예제 #11
0
 def test_get_config(self):
     # we can get valid configs
     conf = get_config()
     assert conf.get('DEFAULT', 'waeup_url') == 'localhost:8080'
예제 #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'
예제 #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)