Skip to content
This repository was archived by the owner on Nov 19, 2018. It is now read-only.

Commit c57fc41

Browse files
author
Tang Chen
committed
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
1 parent ba08683 commit c57fc41

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • openstackclient/tests/compute/v2

openstackclient/tests/compute/v2/fakes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,11 @@ class FakeFlavorResource(fakes.FakeResource):
372372
Need to fake them, otherwise the functions to be tested won't run properly.
373373
"""
374374

375-
# Fake properties.
376-
_keys = {'property': 'value'}
375+
def __init__(self, manager=None, info={}, loaded=False, methods={}):
376+
super(FakeFlavorResource, self).__init__(manager, info,
377+
loaded, methods)
378+
# Fake properties.
379+
self._keys = {'property': 'value'}
377380

378381
def set_keys(self, args):
379382
self._keys.update(args)

0 commit comments

Comments
 (0)