summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavaL <ayoyo@thoughtworks.com>2016-02-08 10:43:59 +0000
committerNavaL <ayoyo@thoughtworks.com>2016-02-08 10:43:59 +0000
commit44f560887d48c1b0980613760453e9f8740a6fd6 (patch)
tree131c0c951c2d5727a9ffc52ae0f57e52af7b8aad
parentbb37f1a89661c4f3de8f4827d4ec48277c867563 (diff)
mocking register/unregister key generation event, on close
- fixing build Issue #586
-rw-r--r--service/test/unit/bitmask_libraries/test_session.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/service/test/unit/bitmask_libraries/test_session.py b/service/test/unit/bitmask_libraries/test_session.py
index bb1f55ca..9654e624 100644
--- a/service/test/unit/bitmask_libraries/test_session.py
+++ b/service/test/unit/bitmask_libraries/test_session.py
@@ -69,15 +69,19 @@ class SessionTest(AbstractLeapTest):
unregister_mock.assert_called_once_with(KEYMANAGER_FINISHED_KEY_GENERATION, uid=email)
- def test_close_stops_soledad(self):
+ @patch('pixelated.bitmask_libraries.session.register')
+ def test_close_stops_soledad(self, _):
email = 'someone@somedomain.tld'
self.provider.address_for.return_value = email
session = self._create_session()
- session.close()
+ with patch('pixelated.bitmask_libraries.session.unregister') as unregister_mock:
+ session.close()
+
self.soledad_session.close.assert_called_once_with()
- def test_close_removes_session_from_cache(self):
+ @patch('pixelated.bitmask_libraries.session.register')
+ def test_close_removes_session_from_cache(self, _):
email = 'someone@somedomain.tld'
self.provider.address_for.return_value = email
session = self._create_session()
@@ -87,7 +91,8 @@ class SessionTest(AbstractLeapTest):
self.assertEqual(session, SessionCache.lookup_session(key))
- session.close()
+ with patch('pixelated.bitmask_libraries.session.unregister') as unregister_mock:
+ session.close()
self.assertIsNone(SessionCache.lookup_session(key))