Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 30f0240

Browse files
authored
Make is_public Optional[bool] for create_room_as test util (#10951) (#10963)
Signed-off-by: Andrew Ferrazzutti <[email protected]>
1 parent 730b40d commit 30f0240

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

changelog.d/10963.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the test utility function `create_room_as` so that `is_public=True` will explicitly set the `visibility` parameter of room creation requests to `public`. Contributed by @AndrewFerr.

tests/rest/client/utils.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class RestHelper:
4848
def create_room_as(
4949
self,
5050
room_creator: Optional[str] = None,
51-
is_public: bool = True,
51+
is_public: Optional[bool] = None,
5252
room_version: Optional[str] = None,
5353
tok: Optional[str] = None,
5454
expect_code: int = 200,
@@ -62,9 +62,10 @@ def create_room_as(
6262
6363
Args:
6464
room_creator: The user ID to create the room with.
65-
is_public: If True, the `visibility` parameter will be set to the
66-
default (public). Otherwise, the `visibility` parameter will be set
67-
to "private".
65+
is_public: If True, the `visibility` parameter will be set to
66+
"public". If False, it will be set to "private". If left
67+
unspecified, the server will set it to an appropriate default
68+
(which should be "private" as per the CS spec).
6869
room_version: The room version to create the room as. Defaults to Synapse's
6970
default room version.
7071
tok: The access token to use in the request.
@@ -77,8 +78,8 @@ def create_room_as(
7778
self.auth_user_id = room_creator
7879
path = "/_matrix/client/r0/createRoom"
7980
content = extra_content or {}
80-
if not is_public:
81-
content["visibility"] = "private"
81+
if is_public is not None:
82+
content["visibility"] = "public" if is_public else "private"
8283
if room_version:
8384
content["room_version"] = room_version
8485
if tok:

0 commit comments

Comments
 (0)