def setUp(self): super(PolicyFixture, self).setUp() self.policy_dir = self.useFixture(fixtures.TempDir()) self.policy_file_name = os.path.join(self.policy_dir.path, 'policy.json') with open(self.policy_file_name, 'w') as policy_file: policy_file.write(fake_policy.policy_data) CONF.set_override('policy_file', self.policy_file_name) ironic_policy.reset() ironic_policy.init() self.addCleanup(ironic_policy.reset)
def test_policy_file_not_found(self): ironic_policy.reset() CONF.set_override('policy_file', '/non/existent/policy/file') self.assertRaises(exception.ConfigNotFound, ironic_policy.init)
def test_policy_file_not_found(self): ironic_policy.reset() CONF.set_override('policy_file', '/non/existant/policy/file') self.assertRaises(exception.ConfigNotFound, ironic_policy.init)