Fix tests by mandating AS have sender.
We require application services to be configured with a sender, so we may as well require it when creating an ApplicationService object.pull/8616/head
parent
49bb079d87
commit
492e15e3b6
|
@ -52,11 +52,12 @@ class ApplicationService:
|
|||
self,
|
||||
token,
|
||||
hostname,
|
||||
*,
|
||||
id,
|
||||
sender,
|
||||
url=None,
|
||||
namespaces=None,
|
||||
hs_token=None,
|
||||
sender=None,
|
||||
id=None,
|
||||
protocols=None,
|
||||
rate_limited=True,
|
||||
ip_range_whitelist=None,
|
||||
|
|
|
@ -43,7 +43,7 @@ class TestRatelimiter(unittest.TestCase):
|
|||
|
||||
def test_allowed_appservice_ratelimited_via_can_requester_do_action(self):
|
||||
appservice = ApplicationService(
|
||||
None, "example.com", id="foo", rate_limited=True,
|
||||
None, "example.com", id="foo", rate_limited=True, sender="@as:example.com",
|
||||
)
|
||||
as_requester = create_requester("@user:example.com", app_service=appservice)
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TestRatelimiter(unittest.TestCase):
|
|||
|
||||
def test_allowed_appservice_via_can_requester_do_action(self):
|
||||
appservice = ApplicationService(
|
||||
None, "example.com", id="foo", rate_limited=False,
|
||||
None, "example.com", id="foo", rate_limited=False, sender="@as:example.com",
|
||||
)
|
||||
as_requester = create_requester("@user:example.com", app_service=appservice)
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class ApplicationServiceTestCase(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.service = ApplicationService(
|
||||
id="unique_identifier",
|
||||
sender="@as:test",
|
||||
url="some_url",
|
||||
token="some_token",
|
||||
hostname="matrix.org", # only used by get_groups_for_user
|
||||
|
|
|
@ -55,6 +55,7 @@ class RegisterRestServletTestCase(unittest.HomeserverTestCase):
|
|||
self.hs.config.server_name,
|
||||
id="1234",
|
||||
namespaces={"users": [{"regex": r"@as_user.*", "exclusive": True}]},
|
||||
sender="@as:test",
|
||||
)
|
||||
|
||||
self.hs.get_datastore().services_cache.append(appservice)
|
||||
|
|
Loading…
Reference in New Issue