Exemple #1
0
 def test_config_parsing_full(self):
     """ Read the test config and compare values. """
     test_utils.generate_test_config_file()
     result = gnippy_config.get_config(test_utils.test_config_path)
     self.assertEqual(result['Credentials']['username'], test_utils.test_username)
     self.assertEqual(result['Credentials']['password'], test_utils.test_password)
     self.assertEqual(result['PowerTrack']['url'], test_utils.test_powertrack_url)
Exemple #2
0
 def test_config_parsing_halt(self):
     """ Read the half config file and compare values. """
     test_utils.generate_test_config_file_with_only_auth()
     result = gnippy_config.get_config(test_utils.test_config_path)
     self.assertEqual(result['Credentials']['username'], test_utils.test_username)
     self.assertEqual(result['Credentials']['password'], test_utils.test_password)
     self.assertEqual(result['PowerTrack']['url'], None)
Exemple #3
0
 def test_config_parsing_halt(self):
     """ Read the half config file and compare values. """
     test_utils.generate_test_config_file_with_only_auth()
     result = gnippy_config.get_config(test_utils.test_config_path)
     self.assertEqual(result['Credentials']['username'],
                      test_utils.test_username)
     self.assertEqual(result['Credentials']['password'],
                      test_utils.test_password)
     self.assertEqual(result['PowerTrack']['url'], None)
Exemple #4
0
 def test_config_parsing_full(self):
     """ Read the test config and compare values. """
     test_utils.generate_test_config_file()
     result = gnippy_config.get_config(test_utils.test_config_path)
     self.assertEqual(result['Credentials']['username'],
                      test_utils.test_username)
     self.assertEqual(result['Credentials']['password'],
                      test_utils.test_password)
     self.assertEqual(result['PowerTrack']['url'],
                      test_utils.test_powertrack_url)
Exemple #5
0
    def load_config_from_file(self, url, auth, config_file_path):
        """ Attempt to load the config from a file. """
        conf = config.get_config(config_file_path=config_file_path)

        if url is None:
            conf_url = conf['PowerTrack']['url']
            if conf_url:
                self.url = conf['PowerTrack']['url']
        else:
            self.url = url

        if auth is None:
            conf_uname = conf['Credentials']['username']
            conf_pwd = conf['Credentials']['password']
            self.auth = (conf_uname, conf_pwd)
        else:
            self.auth = auth
Exemple #6
0
    def load_config_from_file(self, url, auth, config_file_path):
        """ Attempt to load the config from a file. """
        conf = config.get_config(config_file_path=config_file_path)

        if url is None:
            conf_url = conf["PowerTrack"]["url"]
            if conf_url:
                self.url = conf["PowerTrack"]["url"]
        else:
            self.url = url

        if auth is None:
            conf_uname = conf["Credentials"]["username"]
            conf_pwd = conf["Credentials"]["password"]
            self.auth = (conf_uname, conf_pwd)
        else:
            self.auth = auth
Exemple #7
0
    def load_config_from_file(self, url, auth, config_file_path):
        """ Attempt to load the config from a file. """
        conf = config.get_config(config_file_path=config_file_path)

        if url is None:
            conf_url = conf['PowerTrack']['url']
            if conf_url:
                self.url = conf['PowerTrack']['url']
        else:
            self.url = url

        if auth is None:
            conf_uname = conf['Credentials']['username']
            conf_pwd = conf['Credentials']['password']
            self.auth = (conf_uname, conf_pwd)
        else:
            self.auth = auth