From 509ed96c6ffd6171f16d3e0217ac8f88627e2420 Mon Sep 17 00:00:00 2001 From: Ken'ichi Ohmichi Date: Wed, 27 Aug 2014 04:50:23 +0000 Subject: [PATCH] Remove duplicated negative factors in keypair test In test_keypair_create_fail_policy, there are two negative factors. One is a policy violation, and another is a bad request body. The purpose of the test is checking the policy violation, so a bad request body is not right for this test. This patch removes a bad request body from the test. Change-Id: Ia165e08410b0576950efe83e5ab6a92c9c7f6a50 --- nova/tests/api/openstack/compute/contrib/test_keypairs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/tests/api/openstack/compute/contrib/test_keypairs.py b/nova/tests/api/openstack/compute/contrib/test_keypairs.py index fb53eefc9800..62c44a721208 100644 --- a/nova/tests/api/openstack/compute/contrib/test_keypairs.py +++ b/nova/tests/api/openstack/compute/contrib/test_keypairs.py @@ -373,6 +373,7 @@ class KeypairPolicyTest(test.TestCase): self.assertIn('keypair', res) def test_keypair_create_fail_policy(self): + body = {'keypair': {'name': 'create_test'}} rules = {'compute_extension:keypairs:create': common_policy.parse_rule('role:admin')} policy.set_rules(rules) @@ -380,7 +381,7 @@ class KeypairPolicyTest(test.TestCase): req.method = 'POST' self.assertRaises(exception.Forbidden, self.KeyPairController.create, - req, {}) + req, body) def test_keypair_create_pass_policy(self): body = {'keypair': {'name': 'create_test'}}