test_search_mem.py
1.84 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
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):
interfaceUrl = '/contact/Apicp/User/DepartmentMember'
data = {
}
result = self.PcPost(interfaceUrl, data)
print('接口地址:' + self.host + '/' + self.domain + interfaceUrl)
# print(result)
return result
# 按姓名搜索
def test_search_name(self):
interfaceUrl = '/contact/Apicp/User/DepartmentMember'
data = {
'name': '刘洋'
}
result = self.PcPost(interfaceUrl, data)
type(result)
print('接口地址: ' + self.host + '/' + self.domain + interfaceUrl)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
# self.assertEqual('ok', result['errsdkcode'], msg=result['errsdkcode']) # 怎样断言返回结果中的limit(动态)数据?
# print(result)
return result
def test_search_mobile(self):
interfaceurl = '/contact/Apicp/User/DepartmentMember'
data = {
'mobile': 13818801804
}
result = self.PcPost(interfaceurl, data)
print('接口地址:' + self.host + '/' + self.domain + interfaceurl)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
return result
def test_search_role(self):
interfaceurl = '/contact/Apicp/User/DepartmentMember'
data = {
'role_ids[0]': '6B3BC32E0A692CB96B91BD6A4C2D06BB' # 需动态获取角色列表数据作为参数读取
}
result = self.PcPost(interfaceurl, data)
self.assertEqual(0, result['errcode'], msg=result['errcode'])
print(result)
return result
if __name__ == '__main__':
unittest.main()