test_search_mem.py
1.8 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import unittest
from atdd.PcPost import PcPost
class SearchMem(PcPost):
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
# 全部列表
def test_search_mem(self):
url = '/contact/Apicp/User/DepartmentMember'
data = {
}
result = self.PcPost(url, data)
print('接口地址:' + self.host + '/' + self.domain + url)
# print(result)
return result
# 按姓名搜索
def test_search_name(self):
url = '/contact/Apicp/User/DepartmentMember'
data = {
'name': '刘洋'
}
result = self.PcPost(url, data)
type(result)
print('接口地址: ' + self.host + '/' + self.domain + url)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
# self.assertEqual('ok', result['errsdkcode'], msg=result['errsdkcode']) # 怎样断言返回结果中的limit(动态)数据?
return result
# 按手机号搜索
def test_search_mobile(self):
url = '/contact/Apicp/User/DepartmentMember'
data = {
'mobile': 13818801804
}
result = self.PcPost(url, data)
print('接口地址:' + self.host + '/' + self.domain + url)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
return result
# 按角色搜索
def test_search_role(self):
url = '/contact/Apicp/User/DepartmentMember'
data = {
'role_ids[0]': '755DE1EC0A69039F18591A299B47E6F3' # 需动态获取角色列表数据作为参数读取
}
result = self.PcPost(url, data)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
print(result) # 返回结果待验证?
return result
if __name__ == '__main__':
unittest.main()