1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 21:30:39 +00:00

[api2] Add user info to file comment obj

This commit is contained in:
zhengxie
2016-05-21 18:25:09 +08:00
committed by llj
parent c19b781713
commit fe999b7559
6 changed files with 84 additions and 8 deletions

View File

@@ -24,6 +24,20 @@ class FileCommentsTest(BaseTestCase):
json_resp = json.loads(resp.content)
assert len(json_resp['comments']) == 1
assert json_resp['comments'][0]['comment'] == o.comment
assert 'avatars' in json_resp['comments'][0]['avatar_url']
def test_can_list_with_avatar_size(self):
o = FileComment.objects.add_by_file_path(repo_id=self.repo.id,
file_path=self.file,
author=self.user.username,
comment='test comment')
resp = self.client.get(self.endpoint + '&avatar_size=20')
self.assertEqual(200, resp.status_code)
json_resp = json.loads(resp.content)
assert len(json_resp['comments']) == 1
assert json_resp['comments'][0]['comment'] == o.comment
assert 'avatars' in json_resp['comments'][0]['avatar_url']
def test_can_post(self):
resp = self.client.post(self.endpoint, {
@@ -33,6 +47,17 @@ class FileCommentsTest(BaseTestCase):
json_resp = json.loads(resp.content)
assert json_resp['comment'] == 'new comment'
assert 'avatars' in json_resp['avatar_url']
def test_can_post_with_avatar_size(self):
resp = self.client.post(self.endpoint + '&avatar_size=20', {
'comment': 'new comment'
})
self.assertEqual(201, resp.status_code)
json_resp = json.loads(resp.content)
assert json_resp['comment'] == 'new comment'
assert 'avatars' in json_resp['avatar_url']
def test_invalid_user(self):
self.logout()