From dba6ff47c6c14cbf0fca164bfaf1ec9c4d258792 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Fri, 5 Mar 2021 11:48:03 +0000 Subject: [PATCH] Fix test --- tests/test_mau.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests/test_mau.py b/tests/test_mau.py index 75d28a42dfe5..3369422f0fa7 100644 --- a/tests/test_mau.py +++ b/tests/test_mau.py @@ -17,7 +17,7 @@ import json -from synapse.api.constants import LoginType +from synapse.api.constants import AppserviceRegistrationType, LoginType from synapse.api.errors import Codes, HttpResponseException, SynapseError from synapse.appservice import ApplicationService from synapse.rest.client.v2_alpha import register, sync @@ -113,7 +113,7 @@ def test_as_ignores_mau(self): ) ) - self.create_user("as_kermit4", token=as_token) + self.create_user("as_kermit4", token=as_token, appservice=True) def test_allowed_after_a_month_mau(self): # Create and sync so that the MAU counts get updated @@ -232,19 +232,20 @@ def test_tracked_but_not_limited(self): self.reactor.advance(100) self.assertEqual(2, self.successResultOf(count)) - def create_user(self, localpart, token=None): - request_data = json.dumps( - { - "username": localpart, - "password": "monkey", - "auth": {"type": LoginType.DUMMY}, - } - ) + def create_user(self, localpart, token=None, appservice=False): + request_data = { + "username": localpart, + "password": "monkey", + "auth": {"type": LoginType.DUMMY}, + } + + if appservice: + request_data["type"] = AppserviceRegistrationType channel = self.make_request( "POST", "/register", - request_data, + json.dumps(request_data), access_token=token, )