1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

[tests] add web api test for libraries

This commit is contained in:
Chilledheart
2014-08-28 11:35:19 +08:00
committed by lins05
parent ba84dc87b3
commit 878f9dfc5b
4 changed files with 251 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
from integration_api import MISC_LIST_EVENTS_URL, MISC_LIST_GROUP_AND_CONTACTS_URL
from integration_api import get_authed_instance, IS_PRO
from integration_api import get_authed_instance, IS_PRO, MISC_SEARCH_URL
import unittest
class MiscApiTestCase(unittest.TestCase):
@@ -20,6 +20,25 @@ class MiscApiTestCase(unittest.TestCase):
self.assertIsNotNone(json['gmsgnum'])
self.assertIsNotNone(json['newreplies'])
def testSearchApi(self):
# if not pro, skip this
if (IS_PRO == False):
return
res = self.requests.get(MISC_SEARCH_URL + u'?q=*')
self.assertEqual(res.status_code, 200)
json = res.json()
self.assertIsNotNone(json)
self.assertIsNotNone(json['has_more'])
self.assertIsNotNone(json['total'])
self.assertIsNotNone(json['results'])
for result in json['results']:
self.assertIsNotNone(result['repo_id'])
self.assertIsNotNone(result['name'])
self.assertIsNotNone(result['old'])
self.assertIsNotNone(result['last_modified'])
self.assertIsNotNone(result['fullpath'])
self.assertIsNotNone(result['size'])
def testListEventsApi(self):
# if not pro, skip this
if (IS_PRO == False):