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:
@@ -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):
|
||||
|
Reference in New Issue
Block a user