From c57fc41c33df58237f6b3ec8a5b2a0ff9573da2e Mon Sep 17 00:00:00 2001 From: Tang Chen Date: Tue, 23 Feb 2016 00:14:56 +0800 Subject: [PATCH] Initialize _keys in __init__() in FakeFlavorResource _keys is defined as a class attribute in FakeFlavorResource. So when we call set_keys() to update it, it changes. And this change may bring trouble to the other tests afterward. So define and initialize it in __init__() as an object attribute. Change-Id: Ib18c03877b67e1b7c2e107f598076b928a58e4fb Closes-bug: #1548378 --- openstackclient/tests/compute/v2/fakes.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/openstackclient/tests/compute/v2/fakes.py b/openstackclient/tests/compute/v2/fakes.py index 96d85b0c06..c0db9b24c9 100644 --- a/openstackclient/tests/compute/v2/fakes.py +++ b/openstackclient/tests/compute/v2/fakes.py @@ -372,8 +372,11 @@ class FakeFlavorResource(fakes.FakeResource): Need to fake them, otherwise the functions to be tested won't run properly. """ - # Fake properties. - _keys = {'property': 'value'} + def __init__(self, manager=None, info={}, loaded=False, methods={}): + super(FakeFlavorResource, self).__init__(manager, info, + loaded, methods) + # Fake properties. + self._keys = {'property': 'value'} def set_keys(self, args): self._keys.update(args)