mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 00:00:00 +00:00
Merge pull request #1283 from haiwen/license-user
[api] return licensed to info when get sysinfo
This commit is contained in:
@@ -121,6 +121,7 @@ class SysInfo(APIView):
|
||||
'with_license': with_license,
|
||||
'license_expiration': license_dict.get('Expiration', ''),
|
||||
'license_maxusers': max_users,
|
||||
'license_to': license_dict.get('Name', ''),
|
||||
}
|
||||
|
||||
return Response(info)
|
||||
|
@@ -73,6 +73,8 @@
|
||||
<dd><% if (is_pro) { %>
|
||||
{% trans "Professional Edition" %}
|
||||
<% if (with_license) { %>
|
||||
{% trans "licensed to" %} <%- license_to %>
|
||||
,
|
||||
{% trans "expires on" %} <%- license_expiration %>
|
||||
<% } %>
|
||||
<% } else { %>
|
||||
|
@@ -22,7 +22,7 @@ class SysinfoTest(BaseTestCase):
|
||||
resp = self.client.get(url)
|
||||
json_resp = json.loads(resp.content)
|
||||
|
||||
assert len(json_resp) == 10
|
||||
assert len(json_resp) == 11
|
||||
assert json_resp['is_pro'] is False
|
||||
assert json_resp['multi_tenancy_enabled'] is False
|
||||
assert json_resp['license_maxusers'] == 0
|
||||
@@ -31,10 +31,12 @@ class SysinfoTest(BaseTestCase):
|
||||
@patch('seahub.api2.endpoints.admin.sysinfo.SysInfo._get_license_dict')
|
||||
def test_get_sysinfo_in_pro_edition(self, mock_get_license_dict, mock_is_pro_version):
|
||||
|
||||
test_user = 'Test user'
|
||||
|
||||
mock_is_pro_version.return_value = True
|
||||
mock_get_license_dict.return_value = {
|
||||
'Hash': '2981bd12cf0c83c81aaa453ce249ffdd2e492ed2220f3c89c57f06518de36c487c873be960577a0534f3de4ac2bb52d3918016aaa07d60dccbce92673bc23604f4d8ff547f88287c398f74f16e114a8a3b978cce66961fd0facd283da7b050b5fc6205934420e1b4a65daf1c6dcdb2dc78e38a3799eeb5533779595912f1723129037f093f925d8ab94478c8aded304c62d003c07a6e98e706fdf81b6f73c3a806f523bbff1a92f8eb8ea325e09b2b80acfc4b99dd0f5b339d5ed832da00bad3394b9d40a09cce6066b6dc2c9b2ec47338de41867f5c2380c96f7708a5e9cdf244fbdfa1cc174751b90e74e620f53778593b84ec3b15175c3e432c20dcb4cfde',
|
||||
'Name': 'Test',
|
||||
'Name': test_user,
|
||||
'Mode': 'life-time',
|
||||
'Licencetype': 'User',
|
||||
'LicenceKEY': '1461659711',
|
||||
@@ -47,5 +49,6 @@ class SysinfoTest(BaseTestCase):
|
||||
resp = self.client.get(url)
|
||||
json_resp = json.loads(resp.content)
|
||||
|
||||
assert len(json_resp) == 10
|
||||
assert len(json_resp) == 11
|
||||
assert json_resp['license_maxusers'] == 500
|
||||
assert json_resp['license_to'] == test_user
|
||||
|
Reference in New Issue
Block a user