-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1324 from longguikeji/feature-402
feat: 🎸 增加了测试用例
- Loading branch information
Showing
13 changed files
with
736 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from tests import TestCase | ||
|
||
class TestScimSyncApi(TestCase): | ||
|
||
def test_list_scim_syncs(self): | ||
''' | ||
用户数据同步配置列表 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/'.format(self.tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_create_scim_sync(self): | ||
''' | ||
创建用户数据同步配置 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/'.format(self.tenant.id) | ||
body = { | ||
"type":"ArkID", | ||
"config":{ | ||
"user_url":"", | ||
"group_url":"", | ||
"mode":"server" | ||
}, | ||
"name":"一个新配置", | ||
"package":"com.longgui.scim.sync.arkid" | ||
} | ||
resp = self.client.post(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_get_scim_sync(self): | ||
''' | ||
获取用户数据同步配置 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/{}/'.format(self.tenant.id, self.scim_sync.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_update_scim_sync(self): | ||
''' | ||
编辑用户数据同步配置 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/{}/'.format(self.tenant.id, self.scim_sync.id) | ||
body = { | ||
"type":"ArkID", | ||
"config":{ | ||
"user_url":"", | ||
"group_url":"", | ||
"mode":"server" | ||
}, | ||
"name":"一个新配置", | ||
"package":"com.longgui.scim.sync.arkid" | ||
} | ||
resp = self.client.put(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_delete_scim_sync(self): | ||
''' | ||
删除用户数据同步配置 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/{}/'.format(self.tenant.id, self.scim_sync.id) | ||
resp = self.client.delete(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_list_scim_servers(self): | ||
''' | ||
用户数据同步配置列表 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_server_list/'.format(self.tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_start_scim_sync(self): | ||
''' | ||
编辑用户数据同步配置 | ||
''' | ||
url = '/api/v1/tenant/{}/scim_syncs/{}/sync_start/'.format(self.tenant.id, self.scim_sync.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from tests import TestCase | ||
|
||
class TestStatisticsApi(TestCase): | ||
|
||
def test_get_statistics_charts(self): | ||
''' | ||
获取统计图表 | ||
''' | ||
url = '/api/v1/tenant/{}/statistics_charts'.format(self.tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
from tests import TestCase | ||
|
||
class TestTenantApi(TestCase): | ||
|
||
def test_list_tenants(self): | ||
''' | ||
获取租户列表 | ||
''' | ||
url = '/api/v1/tenants/' | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_get_tenant(self): | ||
''' | ||
获取租户 | ||
''' | ||
url = '/api/v1/tenants/{}/'.format(self.tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_create_tenant(self): | ||
''' | ||
创建租户 | ||
''' | ||
url = '/api/v1/tenants/' | ||
body = { | ||
'name': '创建1', | ||
'slug': 'slug11', | ||
'icon': '' | ||
} | ||
resp = self.client.post(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_update_tenant(self): | ||
''' | ||
编辑租户 | ||
''' | ||
url = '/api/v1/tenants/{}/'.format(self.create_tenant.id) | ||
body = { | ||
'name': '创建11', | ||
} | ||
resp = self.client.post(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_delete_tenant(self): | ||
''' | ||
删除租户 | ||
''' | ||
url = '/api/v1/tenants/{}/'.format(self.create_tenant.id) | ||
resp = self.client.delete(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_get_tenant_config(self): | ||
''' | ||
获取租户配置 | ||
''' | ||
url = '/api/v1/tenants/{}/config/'.format(self.create_tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_update_tenant_config(self): | ||
''' | ||
编辑租户配置 | ||
''' | ||
url = '/api/v1/tenants/{}/config/'.format(self.create_tenant.id) | ||
body = { | ||
'name': '创建1', | ||
'slug': 'slug11', | ||
'icon': '', | ||
'token_duration_minutes': 1440 | ||
} | ||
resp = self.client.post(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_default_tenant(self): | ||
''' | ||
获取当前域名下的默认租户(如无slug则为平台租户) | ||
''' | ||
url = '/api/v1/default_tenant/'.format(self.create_tenant.id) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_logout_tenant(self): | ||
''' | ||
注销租户 | ||
''' | ||
url = '/api/v1/tenants/{}/logout/'.format(self.create_tenant.id) | ||
body = { | ||
'password': 'admin', | ||
} | ||
resp = self.client.post(url, body ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) | ||
|
||
def test_get_tenant_by_slug(self): | ||
''' | ||
获取租户slug | ||
''' | ||
url = '/api/v1/tenants/tenant_by_slug/{}/'.format(self.create_tenant.slug) | ||
resp = self.client.get(url ,content_type='application/json') | ||
self.assertEqual(resp.status_code, 200, resp.content.decode()) |
Oops, something went wrong.