Beispiel #1
0
    def test_config_get_custom_conf(self):
        conf = config.ConfigurationManager()
        conf.read(M_CUSTOM_CONFIG_PATH)

        self.assertEqual('ovh-ca', conf.get('default', 'endpoint'))
        self.assertEqual('This is a fake custom application key',   conf.get('ovh-ca', 'application_key'))
        self.assertEqual('This is a *real* custom application key', conf.get('ovh-ca', 'application_secret'))
        self.assertEqual('I am customingly kidding',                conf.get('ovh-ca', 'consumer_key'))
        self.assertTrue(conf.get('ovh-eu', 'non-existent') is None)
Beispiel #2
0
    def test_config_get_conf_env_rules_them_all(self):
        conf = config.ConfigurationManager()

        with mock.patch.dict('os.environ', M_ENVIRON):
            self.assertEqual(M_ENVIRON['OVH_ENDPOINT'],           conf.get('wathever', 'endpoint'))
            self.assertEqual(M_ENVIRON['OVH_APPLICATION_KEY'],    conf.get('wathever', 'application_key'))
            self.assertEqual(M_ENVIRON['OVH_APPLICATION_SECRET'], conf.get('wathever', 'application_secret'))
            self.assertEqual(M_ENVIRON['OVH_CONSUMER_KEY'],       conf.get('wathever', 'consumer_key'))

        self.assertTrue(conf.get('ovh-eu', 'non-existent') is None)
Beispiel #3
0
    def test_config_get_conf(self):
        conf = config.ConfigurationManager()

        self.assertEqual('runabove-ca', conf.get('default', 'endpoint'))
        self.assertEqual('This is a *fake* global application key',    conf.get('ovh-eu', 'application_key'))
        self.assertEqual('This is a *real* global application secret', conf.get('ovh-eu', 'application_secret'))
        self.assertEqual('I am kidding at home',                      conf.get('ovh-eu', 'consumer_key'))
        self.assertEqual('This is a fake local application key',   conf.get('runabove-ca', 'application_key'))
        self.assertEqual('This is a *real* local application key', conf.get('runabove-ca', 'application_secret'))
        self.assertEqual('I am locally kidding',                   conf.get('runabove-ca', 'consumer_key'))

        self.assertTrue(conf.get('ovh-eu', 'non-existent') is None)
        self.assertTrue(conf.get('ovh-ca', 'application_key') is None)
        self.assertTrue(conf.get('ovh-laponie', 'application_key') is None)