Use the same reg paths as register v1 for ASes.
Namely this means using registration_handler.appservice_register.pull/210/head
parent
a4d62ba36a
commit
11b0a34074
|
@ -82,7 +82,9 @@ class RegisterRestServlet(RestServlet):
|
||||||
|
|
||||||
# == Application Service Registration ==
|
# == Application Service Registration ==
|
||||||
if appservice:
|
if appservice:
|
||||||
result = yield self._do_appservice_registration(desired_username)
|
result = yield self._do_appservice_registration(
|
||||||
|
desired_username, request.args["access_token"][0]
|
||||||
|
)
|
||||||
defer.returnValue((200, result)) # we throw for non 200 responses
|
defer.returnValue((200, result)) # we throw for non 200 responses
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -166,9 +168,9 @@ class RegisterRestServlet(RestServlet):
|
||||||
return 200, {}
|
return 200, {}
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _do_appservice_registration(self, username):
|
def _do_appservice_registration(self, username, as_token):
|
||||||
(user_id, token) = yield self.registration_handler.register(
|
(user_id, token) = yield self.registration_handler.appservice_register(
|
||||||
localpart=username
|
username, as_token
|
||||||
)
|
)
|
||||||
defer.returnValue(self._create_registration_details(user_id, token))
|
defer.returnValue(self._create_registration_details(user_id, token))
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,9 @@ class RegisterRestServletTestCase(unittest.TestCase):
|
||||||
self.appservice = {
|
self.appservice = {
|
||||||
"id": "1234"
|
"id": "1234"
|
||||||
}
|
}
|
||||||
self.registration_handler.register = Mock(return_value=(user_id, token))
|
self.registration_handler.appservice_register = Mock(
|
||||||
|
return_value=(user_id, token)
|
||||||
|
)
|
||||||
result = yield self.servlet.on_POST(self.request)
|
result = yield self.servlet.on_POST(self.request)
|
||||||
self.assertEquals(result, (200, {
|
self.assertEquals(result, (200, {
|
||||||
"user_id": user_id,
|
"user_id": user_id,
|
||||||
|
|
Loading…
Reference in New Issue