lint
parent
6ad8b02b41
commit
5bd30f57af
|
@ -73,9 +73,7 @@ class PowerLevelsTestCase(HomeserverTestCase):
|
||||||
|
|
||||||
# Mod the mod
|
# Mod the mod
|
||||||
room_power_levels = self.helper.get_state(
|
room_power_levels = self.helper.get_state(
|
||||||
self.room_id,
|
self.room_id, "m.room.power_levels", tok=self.admin_access_token,
|
||||||
"m.room.power_levels",
|
|
||||||
tok=self.admin_access_token,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update existing power levels with mod at PL50
|
# Update existing power levels with mod at PL50
|
||||||
|
@ -113,14 +111,9 @@ class PowerLevelsTestCase(HomeserverTestCase):
|
||||||
self.room_id,
|
self.room_id,
|
||||||
"m.room.server_acl",
|
"m.room.server_acl",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": ["*"],
|
||||||
"*"
|
|
||||||
],
|
|
||||||
"allow_ip_literals": False,
|
"allow_ip_literals": False,
|
||||||
"deny": [
|
"deny": ["*.evil.com", "evil.com"],
|
||||||
"*.evil.com",
|
|
||||||
"evil.com"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
tok=self.mod_access_token,
|
tok=self.mod_access_token,
|
||||||
expect_code=403, # expect failure
|
expect_code=403, # expect failure
|
||||||
|
@ -131,14 +124,9 @@ class PowerLevelsTestCase(HomeserverTestCase):
|
||||||
self.room_id,
|
self.room_id,
|
||||||
"m.room.server_acl",
|
"m.room.server_acl",
|
||||||
{
|
{
|
||||||
"allow": [
|
"allow": ["*"],
|
||||||
"*"
|
|
||||||
],
|
|
||||||
"allow_ip_literals": False,
|
"allow_ip_literals": False,
|
||||||
"deny": [
|
"deny": ["*.evil.com", "evil.com"],
|
||||||
"*.evil.com",
|
|
||||||
"evil.com"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
tok=self.user_access_token,
|
tok=self.user_access_token,
|
||||||
expect_code=403, # expect failure
|
expect_code=403, # expect failure
|
||||||
|
|
|
@ -142,7 +142,16 @@ class RestHelper(object):
|
||||||
|
|
||||||
return channel.json_body
|
return channel.json_body
|
||||||
|
|
||||||
def _read_write_state(self, room_id, event_type, body, tok, expect_code=200, state_key="", method="GET"):
|
def _read_write_state(
|
||||||
|
self,
|
||||||
|
room_id,
|
||||||
|
event_type,
|
||||||
|
body,
|
||||||
|
tok,
|
||||||
|
expect_code=200,
|
||||||
|
state_key="",
|
||||||
|
method="GET",
|
||||||
|
):
|
||||||
path = "/_matrix/client/r0/rooms/%s/state/%s/%s" % (
|
path = "/_matrix/client/r0/rooms/%s/state/%s/%s" % (
|
||||||
room_id,
|
room_id,
|
||||||
event_type,
|
event_type,
|
||||||
|
@ -164,10 +173,14 @@ class RestHelper(object):
|
||||||
return channel.json_body
|
return channel.json_body
|
||||||
|
|
||||||
def get_state(self, room_id, event_type, tok, expect_code=200, state_key=""):
|
def get_state(self, room_id, event_type, tok, expect_code=200, state_key=""):
|
||||||
return self._read_write_state(room_id, event_type, {}, tok, expect_code, state_key, method="GET")
|
return self._read_write_state(
|
||||||
|
room_id, event_type, {}, tok, expect_code, state_key, method="GET"
|
||||||
|
)
|
||||||
|
|
||||||
def send_state(self, room_id, event_type, body, tok, expect_code=200, state_key=""):
|
def send_state(self, room_id, event_type, body, tok, expect_code=200, state_key=""):
|
||||||
return self._read_write_state(room_id, event_type, body, tok, expect_code, state_key, method="PUT")
|
return self._read_write_state(
|
||||||
|
room_id, event_type, body, tok, expect_code, state_key, method="PUT"
|
||||||
|
)
|
||||||
|
|
||||||
def upload_media(
|
def upload_media(
|
||||||
self,
|
self,
|
||||||
|
|
Loading…
Reference in New Issue