-
Notifications
You must be signed in to change notification settings - Fork 254
Expand file tree
/
Copy pathtest_auth.py
More file actions
29 lines (26 loc) · 1.01 KB
/
test_auth.py
File metadata and controls
29 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from tests import TestCase
class TestAuthApi(TestCase):
def test_auth(self):
'''
认证
'''
url = '/api/v1/tenant/{}/auth/?event_tag=com.longgui.auth.factor.password.auth'.format(self.tenant.id)
body = {
"username":"admin",
"password":"admin",
"config_id":"70f8d39e-30cc-40de-8a70-ec6495c21e84"
}
resp = self.client.post(url, body ,content_type='application/json')
self.assertEqual(resp.status_code, 200, resp.content.decode())
def test_reset_passowrd(self):
'''
重置密码
'''
url = '/api/v1/tenant/{}/reset_password/?event_tag=com.longgui.auth.factor.password.auth'.format(self.tenant.id)
body = {
"username":"admin",
"password":"admin",
"config_id":"70f8d39e-30cc-40de-8a70-ec6495c21e84"
}
resp = self.client.post(url, body ,content_type='application/json')
self.assertEqual(resp.status_code, 200, resp.content.decode())