Fix database poison warnings, part 9
The following warning appears in the unit test logs a number of times. "UserWarning: This test uses methods that set internal oslo_db state, but it does not claim to use the database. This will conflict with the setup of tests that do use the database and cause failures later." This patch fixes all the warnings from: unit.api.openstack.compute.test_keypairs.py Note that this warning is only emitted once per unit test worker, so new offenders will show up in the logs each time you fix a test until they are all gone. Change-Id: I4284dd7ecb9c60834dba662838f67d9defc798e2 Related-Bug: #1568414
This commit is contained in:
parent
eec3a2b9e8
commit
46cf8afa17
|
@ -368,7 +368,6 @@ class KeypairPolicyTestV21(test.NoDBTestCase):
|
|||
|
||||
self.stub_out("nova.objects.keypair.KeyPair._get_from_db",
|
||||
_db_key_pair_get)
|
||||
self.stub_out("nova.db.key_pair_destroy", db_key_pair_destroy)
|
||||
|
||||
self.req = fakes.HTTPRequest.blank('')
|
||||
|
||||
|
@ -379,7 +378,8 @@ class KeypairPolicyTestV21(test.NoDBTestCase):
|
|||
self.KeyPairController.index,
|
||||
self.req)
|
||||
|
||||
def test_keypair_list_pass_policy(self):
|
||||
@mock.patch('nova.objects.KeyPairList.get_by_user')
|
||||
def test_keypair_list_pass_policy(self, mock_get):
|
||||
rules = {self.policy_path + ':index': ''}
|
||||
policy.set_rules(oslo_policy.Rules.from_dict(rules))
|
||||
res = self.KeyPairController.index(self.req)
|
||||
|
@ -430,7 +430,8 @@ class KeypairPolicyTestV21(test.NoDBTestCase):
|
|||
self.KeyPairController.delete,
|
||||
self.req, 'FAKE')
|
||||
|
||||
def test_keypair_delete_pass_policy(self):
|
||||
@mock.patch('nova.objects.KeyPair.destroy_by_name')
|
||||
def test_keypair_delete_pass_policy(self, mock_destroy):
|
||||
rules = {self.policy_path + ':delete': ''}
|
||||
policy.set_rules(oslo_policy.Rules.from_dict(rules))
|
||||
self.KeyPairController.delete(self.req, 'FAKE')
|
||||
|
|
Loading…
Reference in New Issue