From ab046fba3a108f90cefbe1e9adb48744af21297d Mon Sep 17 00:00:00 2001 From: zhiyuan_cai Date: Thu, 6 Apr 2017 18:58:39 +0800 Subject: [PATCH] [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 --- tricircle/tests/unit/network/test_central_plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tricircle/tests/unit/network/test_central_plugin.py b/tricircle/tests/unit/network/test_central_plugin.py index d156d1dc..3674bd30 100644 --- a/tricircle/tests/unit/network/test_central_plugin.py +++ b/tricircle/tests/unit/network/test_central_plugin.py @@ -894,6 +894,9 @@ class FakeSession(object): return dummy_method + def __contains__(self, item): + return False + @property def is_active(self): return True