[Urgent] Add __contains__ method to FakeSession

1. What is the problem?
After a recent update, Neutron will use "subnet in context.session"
to check if the session contatins subnet object. However, our
simulated class for Session in the unit tests, FakeSession, is not
iterable. Thus unit tests fail.

2. What is the solution to the problem?
Add __contains__ method to FakeSession class to make it support
"in" operation.

3. What the features need to be implemented to the Tricircle
to realize the solution?
No new features. Changes to pass unit tests.

Change-Id: I26689fdd86e1cce04b9178576646b481762fb0d6
This commit is contained in:
zhiyuan_cai 2017-04-06 18:58:39 +08:00
parent 819b3fa96a
commit ab046fba3a
1 changed files with 3 additions and 0 deletions

View File

@ -894,6 +894,9 @@ class FakeSession(object):
return dummy_method return dummy_method
def __contains__(self, item):
return False
@property @property
def is_active(self): def is_active(self):
return True return True