summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-07-19 13:12:22 +0100
committerRichard van der Hoff <richard@matrix.org>2016-07-19 13:12:22 +0100
commit0da0d0a29d807c481152b1580acbbe36f24cf771 (patch)
tree8a02a5eff71ad6410b726ee2d41233590b6b907d /tests/rest
parentMerge pull request #930 from matrix-org/markjh/handlers (diff)
downloadsynapse-0da0d0a29d807c481152b1580acbbe36f24cf771.tar.xz
rest/client/v2_alpha/register.py: Refactor flow somewhat.
This is meant to be an *almost* non-functional change, with the exception that
it fixes what looks a lot like a bug in that it only calls
`auth_handler.add_threepid` and `add_pusher` once instead of three times.

The idea is to move the generation of the `access_token` out of
`registration_handler.register`, because `access_token`s now require a
device_id, and we only want to generate a device_id once registration has been
successful.
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/client/v2_alpha/test_register.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/rest/client/v2_alpha/test_register.py b/tests/rest/client/v2_alpha/test_register.py
index cda0a2b27c..9a4215fef7 100644
--- a/tests/rest/client/v2_alpha/test_register.py
+++ b/tests/rest/client/v2_alpha/test_register.py
@@ -114,7 +114,8 @@ class RegisterRestServletTestCase(unittest.TestCase):
             "username": "kermit",
             "password": "monkey"
         }, None)
-        self.registration_handler.register = Mock(return_value=(user_id, token))
+        self.registration_handler.register = Mock(return_value=(user_id, None))
+        self.auth_handler.issue_access_token = Mock(return_value=token)
 
         (code, result) = yield self.servlet.on_POST(self.request)
         self.assertEquals(code, 200)