From 6081842b0b4059bd7d8fdee36172551147b6abd3 Mon Sep 17 00:00:00 2001 From: "Paul \"LeoNerd\" Evans" Date: Thu, 18 Jun 2015 15:05:26 +0100 Subject: [PATCH] Add some rest-level unit tests of new 'published' room creation config key --- tests/rest/client/v1/test_rooms.py | 64 ++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) 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