Beispiel #1
0
 def setUp(self):
     super(JSONDriverTestCase, self).setUp()
     rules_file = '%s/access_rules.json' % unit.TESTCONF
     self.useFixture(
         access_rules_config.AccessRulesConfig(self.config_fixture,
                                               rules_file=rules_file))
     self.driver = json_driver.AccessRulesConfig()
Beispiel #2
0
 def setUp(self):
     super(AccessRulesConfigTestCase, self).setUp()
     rules_file = '%s/access_rules.json' % unit.TESTCONF
     self.useFixture(
         access_rules_config.AccessRulesConfig(self.config_fixture,
                                               rules_file=rules_file))
     self.load_backends()
Beispiel #3
0
 def test_invalid_json_raises_error(self):
     tmpfile = self.useFixture(temporaryfile.SecureTempFile())
     invalid_access_rules = tmpfile.file_name
     with open(invalid_access_rules, 'w') as f:
         f.write("This is an invalid data")
     self.useFixture(
         access_rules_config.AccessRulesConfig(
             self.config_fixture, rules_file=invalid_access_rules))
     self.assertRaises(exception.AccessRulesConfigFileError,
                       json_driver.AccessRulesConfig)
Beispiel #4
0
 def test_create_application_credential_with_invalid_access_rule(self):
     rules_file = '%s/access_rules.json' % unit.TESTCONF
     self.useFixture(access_rules_config.AccessRulesConfig(
         self.config_fixture, rules_file=rules_file))
     self.load_backends()
     app_cred = self._new_app_cred_data(self.user_foo['id'],
                                        project_id=self.project_bar['id'])
     app_cred['access_rules'] = [{
         'service': uuid.uuid4().hex,
         'path': uuid.uuid4().hex,
         'method': uuid.uuid4().hex[16:]
     }]
     self.assertRaises(exception.AccessRuleNotAllowed,
                       self.app_cred_api.create_application_credential,
                       app_cred)