summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorThais Siqueira <thais.siqueira@gmail.com>2017-01-17 17:16:56 -0200
committerThais Siqueira <thais.siqueira@gmail.com>2017-01-17 17:25:49 -0200
commit6e876d879927c9b5f12eb70987b4070c5e8298eb (patch)
treed265028e01b2d3dfdeb54bfe24a0d2c21cfe165f /service
parent8041280bad54599f65fa607da16a2b1b8334d8ae (diff)
[#885] Adds test to ensure the right type for user_uuid and passphrase
with @tayanefernandes
Diffstat (limited to 'service')
-rw-r--r--service/test/unit/config/test_sessions.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/service/test/unit/config/test_sessions.py b/service/test/unit/config/test_sessions.py
index ad4dd590..91a0ef90 100644
--- a/service/test/unit/config/test_sessions.py
+++ b/service/test/unit/config/test_sessions.py
@@ -1,3 +1,4 @@
+# -*- encoding:utf-8 -*-
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
@@ -18,9 +19,8 @@ from mock import patch
from mock import MagicMock
from mockito import when
from twisted.internet import defer
-from pixelated.config.sessions import LeapSession, SessionCache
+from pixelated.config.sessions import LeapSession, SessionCache, LeapSessionFactory
from pixelated.bitmask_libraries.keymanager import UploadKeyError
-
from test.unit.bitmask_libraries.test_abstract_leap import AbstractLeapTest
from leap.common.events.catalog import KEYMANAGER_FINISHED_KEY_GENERATION
@@ -166,6 +166,19 @@ class SessionTest(AbstractLeapTest):
self.assertFalse(session.fresh_account)
+ def test_session_setup_soledad_with_utf8_characters(self):
+ api_cert = MagicMock()
+ leap_session_factory = LeapSessionFactory(self.provider)
+
+ with patch('pixelated.config.sessions.threads.deferToThread') as deferToThreadMock:
+ leap_session_factory.setup_soledad('self.token', u'self.uuid', 'Klünter', api_cert)
+ deferToThreadMock.assert_called_once()
+ args, kwargs = deferToThreadMock.call_args
+ uuid_arg = args[1]
+ pass_arg = kwargs['passphrase']
+ self.assertIs(type(uuid_arg), str, "expected uuid argument to be a string")
+ self.assertIs(type(pass_arg), unicode, "expected passphrase argument to be unicode")
+
def _create_session(self):
return LeapSession(self.provider, self.auth, self.mail_store, self.soledad_session, self.keymanager, self.smtp_mock)