1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 15:09:14 +00:00

[tests] Fix group discussion

This commit is contained in:
zhengxie
2016-03-29 11:45:27 +08:00
parent 8763a32af8
commit cd0b0ac235
2 changed files with 7 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ class GroupDiscussionsTest(BaseTestCase):
resp = self.client.get(self.endpoint)
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert len(json_resp) == 1
assert len(json_resp['msgs']) == 1
def test_can_list_with_paginator(self):
for i in range(10):
@@ -28,18 +28,18 @@ class GroupDiscussionsTest(BaseTestCase):
resp = self.client.get(self.endpoint + '?page=1&per_page=5')
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert len(json_resp) == 5
assert json_resp[0]['content'] == 'msg 9'
assert len(json_resp['msgs']) == 5
assert json_resp['msgs'][0]['content'] == 'msg 9'
resp = self.client.get(self.endpoint + '?page=2&per_page=5')
json_resp = json.loads(resp.content)
assert len(json_resp) == 5
assert json_resp[-1]['content'] == 'msg 0'
assert len(json_resp['msgs']) == 5
assert json_resp['msgs'][-1]['content'] == 'msg 0'
resp = self.client.get(self.endpoint + '?page=3&per_page=5')
json_resp = json.loads(resp.content)
assert len(json_resp) == 5
assert json_resp[-1]['content'] == 'msg 0'
assert len(json_resp['msgs']) == 5
assert json_resp['msgs'][-1]['content'] == 'msg 0'
def test_can_not_list_when_invalid_user(self):
self.logout()