mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 18:15:53 +03:00
Add some rest-level unit tests of new 'published' room creation config key
This commit is contained in:
parent
1ecbb260d0
commit
6081842b0b
1 changed files with 64 additions and 0 deletions
|
@ -558,6 +558,70 @@ class RoomsCreateTestCase(RestTestCase):
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertTrue("room_id" in response)
|
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
|
@defer.inlineCallbacks
|
||||||
def test_post_room_custom_key(self):
|
def test_post_room_custom_key(self):
|
||||||
# POST with custom config keys, expect new room id
|
# POST with custom config keys, expect new room id
|
||||||
|
|
Loading…
Reference in a new issue