diff --git a/tests/config/__init__.py b/tests/config/__init__.py
index 3d833a2e44..587ee42067 100644
--- a/tests/config/__init__.py
+++ b/tests/config/__init__.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2016 OpenMarket Ltd
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test___main__.py b/tests/config/test___main__.py
index 7af635f5ec..ca8884823c 100644
--- a/tests/config/test___main__.py
+++ b/tests/config/test___main__.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2021 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_appservice.py b/tests/config/test_appservice.py
index 3a2e268d73..e3021b59d8 100644
--- a/tests/config/test_appservice.py
+++ b/tests/config/test_appservice.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2023 Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_background_update.py b/tests/config/test_background_update.py
index 984365d595..678a068481 100644
--- a/tests/config/test_background_update.py
+++ b/tests/config/test_background_update.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2022 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_base.py b/tests/config/test_base.py
index 41ade50714..edb91bc4d9 100644
--- a/tests/config/test_base.py
+++ b/tests/config/test_base.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2020 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_cache.py b/tests/config/test_cache.py
index 2108b40ff4..631263b5ca 100644
--- a/tests/config/test_cache.py
+++ b/tests/config/test_cache.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2020 Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_generate.py b/tests/config/test_generate.py
index 95b13defba..5ab96e16e1 100644
--- a/tests/config/test_generate.py
+++ b/tests/config/test_generate.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2016 OpenMarket Ltd
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_load.py b/tests/config/test_load.py
index ef9976fb8d..479d2aab91 100644
--- a/tests/config/test_load.py
+++ b/tests/config/test_load.py
@@ -1,6 +1,8 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2021 The Matrix.org Foundation C.I.C.
+# Copyright 2016 OpenMarket Ltd
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_oauth_delegation.py b/tests/config/test_oauth_delegation.py
index 79c10b10a6..713bddeb90 100644
--- a/tests/config/test_oauth_delegation.py
+++ b/tests/config/test_oauth_delegation.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2023 Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_ratelimiting.py b/tests/config/test_ratelimiting.py
index 8267089298..0d52a96858 100644
--- a/tests/config/test_ratelimiting.py
+++ b/tests/config/test_ratelimiting.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2019 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_registration_config.py b/tests/config/test_registration_config.py
index 16e3e13dd0..7fd6df2f93 100644
--- a/tests/config/test_registration_config.py
+++ b/tests/config/test_registration_config.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2021 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_room_directory.py b/tests/config/test_room_directory.py
index 574697cfd9..e25f7787f4 100644
--- a/tests/config/test_room_directory.py
+++ b/tests/config/test_room_directory.py
@@ -17,15 +17,31 @@
# [This file includes modifications made by New Vector Limited]
#
#
-
import yaml
+from twisted.test.proto_helpers import MemoryReactor
+
+import synapse.rest.admin
+import synapse.rest.client.login
+import synapse.rest.client.room
from synapse.config.room_directory import RoomDirectoryConfig
+from synapse.server import HomeServer
+from synapse.util import Clock
from tests import unittest
+from tests.unittest import override_config
+
+class RoomDirectoryConfigTestCase(unittest.HomeserverTestCase):
+ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
+ self.store = hs.get_datastores().main
+
+ servlets = [
+ synapse.rest.admin.register_servlets,
+ synapse.rest.client.login.register_servlets,
+ synapse.rest.client.room.register_servlets,
+ ]
-class RoomDirectoryConfigTestCase(unittest.TestCase):
def test_alias_creation_acl(self) -> None:
config = yaml.safe_load(
"""
@@ -167,3 +183,20 @@ class RoomDirectoryConfigTestCase(unittest.TestCase):
aliases=["#unofficial_st:example.com", "#blah:example.com"],
)
)
+
+ @override_config({"room_list_publication_rules": []})
+ def test_room_creation_when_publishing_denied(self) -> None:
+ """
+ Test that when room publishing is denied via the config that new rooms can
+ still be created and that the newly created room is not public.
+ """
+
+ user = self.register_user("alice", "pass")
+ token = self.login("alice", "pass")
+ room_id = self.helper.create_room_as(user, is_public=True, tok=token)
+
+ res = self.get_success(self.store.get_room(room_id))
+ assert res is not None
+ is_public, _ = res
+
+ self.assertFalse(is_public)
diff --git a/tests/config/test_tls.py b/tests/config/test_tls.py
index 6cfdd181f0..5c2cefaf5b 100644
--- a/tests/config/test_tls.py
+++ b/tests/config/test_tls.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2019 Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_util.py b/tests/config/test_util.py
index 8071850cce..64538a4628 100644
--- a/tests/config/test_util.py
+++ b/tests/config/test_util.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2021 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/test_workers.py b/tests/config/test_workers.py
index 7a97246064..64c0285d01 100644
--- a/tests/config/test_workers.py
+++ b/tests/config/test_workers.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2022 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
diff --git a/tests/config/utils.py b/tests/config/utils.py
index 7842b88e72..11140ff979 100644
--- a/tests/config/utils.py
+++ b/tests/config/utils.py
@@ -1,6 +1,7 @@
#
# This file is licensed under the Affero General Public License (AGPL) version 3.
#
+# Copyright 2021 The Matrix.org Foundation C.I.C.
# Copyright (C) 2023 New Vector, Ltd
#
# This program is free software: you can redistribute it and/or modify
|