[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
zhiyuan_cai 6 years ago
parent 819b3fa96a
commit ab046fba3a
  1. 3

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