2015-06-25 08:08:14 +00:00
|
|
|
import json
|
2014-08-28 02:21:28 +00:00
|
|
|
import unittest
|
2015-07-23 03:46:56 +00:00
|
|
|
import pytest
|
2014-12-25 03:27:44 +00:00
|
|
|
import requests
|
2015-06-25 08:08:14 +00:00
|
|
|
|
|
|
|
from django.test import TestCase
|
|
|
|
|
|
|
|
from seahub import settings
|
2014-09-05 02:07:33 +00:00
|
|
|
from tests.api.apitestbase import ApiTestBase
|
2014-12-25 03:27:44 +00:00
|
|
|
from tests.api.urls import LIST_GROUP_AND_CONTACTS_URL, SERVER_INFO_URL
|
2014-09-05 02:07:33 +00:00
|
|
|
|
2015-06-25 08:08:14 +00:00
|
|
|
class MiscApiTest(ApiTestBase, TestCase):
|
2014-12-25 03:27:44 +00:00
|
|
|
|
|
|
|
def test_server_info(self):
|
|
|
|
r = requests.get(SERVER_INFO_URL)
|
|
|
|
r.raise_for_status()
|
|
|
|
info = r.json()
|
|
|
|
self.assertTrue('version' in info)
|
|
|
|
self.assertTrue('seafile-basic' in info['features'])
|
2015-06-25 08:08:14 +00:00
|
|
|
self.assertFalse('disable-sync-with-any-folder' in info['features'])
|
|
|
|
|
2015-07-23 03:46:56 +00:00
|
|
|
@pytest.mark.xfail
|
2015-06-25 08:08:14 +00:00
|
|
|
def test_server_info_with_disable_sync(self):
|
|
|
|
settings.DISABLE_SYNC_WITH_ANY_FOLDER = True
|
|
|
|
|
|
|
|
resp = self.client.get('/api2/server-info/')
|
|
|
|
info = json.loads(resp.content)
|
|
|
|
self.assertTrue('disable-sync-with-any-folder' in info['features'])
|