diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-06-18 15:05:26 +0100 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2015-06-18 15:05:26 +0100 |
commit | 6081842b0b4059bd7d8fdee36172551147b6abd3 (patch) | |
tree | 4d2cd7ee56c8c3d78f666ed6fa33c98de0878949 | |
parent | Fix logging description name in get_published_rooms() (diff) | |
download | synapse-github/room-publishing.tar.xz |
Add some rest-level unit tests of new 'published' room creation config key github/room-publishing room-publishing
-rw-r--r-- | tests/rest/client/v1/test_rooms.py | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/rest/client/v1/test_rooms.py b/tests/rest/client/v1/test_rooms.py index c83348acf9..56abe3e0fa 100644 --- a/tests/rest/client/v1/test_rooms.py +++ b/tests/rest/client/v1/test_rooms.py @@ -558,6 +558,70 @@ class RoomsCreateTestCase(RestTestCase): self.assertEquals(200, code) self.assertTrue("room_id" in response) + (code, response) = yield self.mock_resource.trigger( + "GET", + "/publicRooms", + "") + self.assertEquals(200, code) + self.assertEquals({ + "start": "START", + "end": "END", + "chunk": [], + }, response) + + @defer.inlineCallbacks + def test_post_room_visibility_public_key(self): + (code, response) = yield self.mock_resource.trigger( + "POST", + "/createRoom", + '{"visibility":"public", ' + '"room_alias_name": "my-alias-test"}') + self.assertEquals(200, code) + self.assertTrue("room_id" in response) + + room_id = response["room_id"] + + (code, response) = yield self.mock_resource.trigger( + "GET", + "/publicRooms", + "") + self.assertEquals(200, code) + self.assertEquals({ + "chunk": [ + { + "room_id": room_id, + "name": None, + "topic": None, + "num_joined_members": 1, + "aliases": ["#my-alias-test:red"], + }, + ], + "start": "START", + "end": "END", + }, response) + + @defer.inlineCallbacks + def test_post_room_visibility_public_unpublished_key(self): + (code, response) = yield self.mock_resource.trigger( + "POST", + "/createRoom", + '{"visibility":"public", ' + '"room_alias_name": "my-alias-test", ' + '"published": false}') + self.assertEquals(200, code) + self.assertTrue("room_id" in response) + + (code, response) = yield self.mock_resource.trigger( + "GET", + "/publicRooms", + "") + self.assertEquals(200, code) + self.assertEquals({ + "chunk": [], + "start": "START", + "end": "END", + }, response) + @defer.inlineCallbacks def test_post_room_custom_key(self): # POST with custom config keys, expect new room id |