summaryrefslogtreecommitdiff
path: root/service/test/unit/bitmask_libraries
diff options
context:
space:
mode:
Diffstat (limited to 'service/test/unit/bitmask_libraries')
-rw-r--r--service/test/unit/bitmask_libraries/test_session.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/service/test/unit/bitmask_libraries/test_session.py b/service/test/unit/bitmask_libraries/test_session.py
index 6e0e6204..bb1f55ca 100644
--- a/service/test/unit/bitmask_libraries/test_session.py
+++ b/service/test/unit/bitmask_libraries/test_session.py
@@ -17,7 +17,7 @@
from mock import patch
from mock import MagicMock
-from pixelated.bitmask_libraries.session import LeapSession
+from pixelated.bitmask_libraries.session import LeapSession, SessionCache
from test_abstract_leap import AbstractLeapTest
from leap.common.events.catalog import KEYMANAGER_FINISHED_KEY_GENERATION
@@ -69,6 +69,28 @@ class SessionTest(AbstractLeapTest):
unregister_mock.assert_called_once_with(KEYMANAGER_FINISHED_KEY_GENERATION, uid=email)
+ def test_close_stops_soledad(self):
+ email = 'someone@somedomain.tld'
+ self.provider.address_for.return_value = email
+ session = self._create_session()
+
+ session.close()
+ self.soledad_session.close.assert_called_once_with()
+
+ def test_close_removes_session_from_cache(self):
+ email = 'someone@somedomain.tld'
+ self.provider.address_for.return_value = email
+ session = self._create_session()
+
+ key = SessionCache.session_key(self.provider, self.auth.username)
+ SessionCache.remember_session(key, session)
+
+ self.assertEqual(session, SessionCache.lookup_session(key))
+
+ session.close()
+
+ self.assertIsNone(SessionCache.lookup_session(key))
+
@patch('pixelated.bitmask_libraries.session.register')
def test_session_fresh_is_initially_false(self, _):
session = self._create_session()