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
This commit is contained in:
Tang Chen 2016-02-23 00:14:56 +08:00
parent ba08683d90
commit c57fc41c33

@ -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)