Commit 179742b27fcb9aff0272c17016bcafee27f3ec1b
1 parent
01959699
角色/岗位/人员列表
Showing
16 changed files
with
234 additions
and
73 deletions
atdd/__pycache__/ATDDCase.cpython-36.pyc
No preview for this file type
atdd/__pycache__/PcPost.cpython-36.pyc
No preview for this file type
tests/Staff_Management/MemberList/Attribute/__init__.py
0 → 100644
tests/Staff_Management/MemberList/Attribute/test_add_Attribute.py
0 → 100644
1 | +import unittest | |
2 | +from atdd.PcPost import PcPost | |
3 | +import random | |
4 | + | |
5 | + | |
6 | +class AddAttribute(PcPost): | |
7 | + name = random.randint(1, 10000) | |
8 | + url = '/contact/Apicp/Attribute/Save' | |
9 | + | |
10 | + def setUp(self): | |
11 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
12 | + | |
13 | + # 字段类型-单行文本(type1) | |
14 | + def test_Attribute1(self): | |
15 | + data = { | |
16 | + 'attr_name': 'AddAttribute' + str(self.name), | |
17 | + 'type': 1, | |
18 | + 'is_open_cp': 1, | |
19 | + 'is_open': 1, | |
20 | + 'is_required_cp': 1, | |
21 | + } | |
22 | + result = self.PcPost(self.url, data) | |
23 | + print('接口地址:' + self.host + self.domain + self.url) | |
24 | + jobId = result['result']['jobId'] | |
25 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
26 | + print('成功生成岗位!岗位ID:' + jobId) | |
27 | + return result | |
28 | + | |
29 | +if __name__ == '__main__': | |
30 | + unittest.main() | ... | ... |
tests/Staff_Management/MemberList/JobList/get_jobid.py
0 → 100644
1 | +import unittest | |
2 | +from atdd.PcPost import PcPost | |
3 | +import random | |
4 | + | |
5 | +class JobId(PcPost): | |
6 | + def setUp(self): | |
7 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
8 | + | |
9 | + # 获取岗位列表,从结果中提取所有jobId的值 | |
10 | + def test_get_alljobid(self): | |
11 | + url = '/Contact/Apicp/Job/List' | |
12 | + data = { | |
13 | + } | |
14 | + result = self.PcPost(url, data) | |
15 | + resultlist = result['result']['list'] # 结果列表中的list信息 | |
16 | + jobIdlist = [] # 创建空列表 | |
17 | + for i in range(len(resultlist)): # 通过序列索引进行遍历 len返回元素个数 | |
18 | + jobId = result['result']['list'][i]['jobId'].split() # 切片取出元素 | |
19 | + jobIdlist[len(jobIdlist):len(jobIdlist)] = jobId | |
20 | + # print(jobIdlist) | |
21 | + return jobIdlist | |
22 | + | |
23 | + def test_get_1jobid(self): | |
24 | + jobIdlist = self.test_get_alljobid() | |
25 | + x = random.randint(0, len(jobIdlist)-1) # 在所有jobID中随机取一个ID值 | |
26 | + jobId = jobIdlist[x] | |
27 | + print("从列表中取一个jobId: " + jobId) | |
28 | + return jobId | |
29 | + | |
30 | +if __name__ == '__main__': | |
31 | + unittest.main() | ... | ... |
tests/Staff_Management/MemberList/JobList/test_add_job.py
... | ... | @@ -13,23 +13,12 @@ class AddJob(PcPost): |
13 | 13 | # 正常添加岗位信息 |
14 | 14 | def test_addjob(self): |
15 | 15 | data = { |
16 | - 'jobName': 'AddJobApi' + str(self.name) # 如何动态读取 | |
16 | + 'jobName': 'AddJobApi' + str(self.name) | |
17 | 17 | } |
18 | 18 | result = self.PcPost(self.url, data) |
19 | 19 | print('接口地址:' + self.host + self.domain + self.url) |
20 | 20 | jobId = result['result']['jobId'] |
21 | - print('成功生成岗位!岗位ID:' + jobId) | |
22 | - # self.assertEqual(jobId, , msg='成功生成测试jobId') # 如何判断生成的Jobid | |
23 | - return result | |
24 | - | |
25 | - # 岗位名称超过20个汉字 | |
26 | - def test_addjob_namelen(self): | |
27 | - url = '/Contact/Apicp/Job/Add' | |
28 | - data = { | |
29 | - 'jobName': '新增岗位接口,测试岗位名称超过20个汉字' + str(self.name) | |
30 | - } | |
31 | - result = self.PcPost(self.url, data) | |
32 | - jobId = result['result']['jobId'] | |
21 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
33 | 22 | print('成功生成岗位!岗位ID:' + jobId) |
34 | 23 | return result |
35 | 24 | ... | ... |
tests/Staff_Management/MemberList/JobList/test_delete_job.py
1 | 1 | import unittest |
2 | 2 | from atdd.PcPost import PcPost |
3 | +from tests.Staff_Management.MemberList.JobList.get_jobid import JobId | |
3 | 4 | |
4 | 5 | |
5 | -class MyTestCase(PcPost): | |
6 | +class DeleteJob(PcPost): | |
7 | + url = '/Contact/Apicp/Job/Delete' | |
8 | + | |
6 | 9 | def setUp(self): |
7 | 10 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
8 | 11 | |
12 | + # 删除岗位 | |
13 | + def test_deletejob(self): | |
14 | + jobId = JobId().test_get_1jobid() | |
15 | + data = { | |
16 | + 'jobId': jobId # 参数化 | |
17 | + } | |
18 | + result = self.PcPost(self.url, data) | |
19 | + # print('接口地址:' + self.host + self.domain + self.url) | |
20 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
21 | + requestId = result['requestId'] | |
22 | + print("删除成功!requestId为: " + requestId) | |
23 | + return result | |
24 | + | |
9 | 25 | if __name__ == '__main__': |
10 | 26 | unittest.main() | ... | ... |
tests/Staff_Management/MemberList/JobList/test_jobMode.py
0 → 100644
1 | +import unittest | |
2 | +from atdd.PcPost import PcPost | |
3 | + | |
4 | + | |
5 | +class JobMode(PcPost): | |
6 | + url = '/Contact/Apicp/Setting/Update' | |
7 | + | |
8 | + def setUp(self): | |
9 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
10 | + | |
11 | + # 岗位设置-开启手动填写 | |
12 | + def test_input(self): | |
13 | + data = { | |
14 | + 'jobMode': 'input' # 手动填写 | |
15 | + } | |
16 | + result = self.PcPost(self.url, data) | |
17 | + print('接口地址:' + self.host + self.domain + self.url) | |
18 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
19 | + requestId = result['requestId'] # 从返回结果中获取requestId值 | |
20 | + print('手动requestId = ' + requestId) | |
21 | + return result | |
22 | + | |
23 | + # 岗位设置-开启配置选择 | |
24 | + def test_select(self): | |
25 | + data = { | |
26 | + 'jobMode': 'select' # 配置选择 | |
27 | + } | |
28 | + result = self.PcPost(self.url, data) | |
29 | + print('接口地址:' + self.host + self.domain + self.url) | |
30 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
31 | + requestId = result['requestId'] | |
32 | + print('选择requestId = ' + requestId) | |
33 | + return result | |
34 | + | |
35 | + | |
36 | +if __name__ == '__main__': | |
37 | + unittest.main() | ... | ... |
tests/Staff_Management/MemberList/MemberList/get_menInf.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | +import random | |
3 | + | |
4 | + | |
5 | +class GetMemInf(PcPost): | |
6 | + def setUp(self): | |
7 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
8 | + | |
9 | + # 获取员工列表接口 | |
10 | + def test_memnamelist(self): | |
11 | + url = "/contact/Apicp/User/DepartmentMember" | |
12 | + data = { | |
13 | + } | |
14 | + result = self.PcPost(url, data) | |
15 | + print(self.host + '/' + self.domain + url) | |
16 | + self.assertEqual("ok", result["errmsg"], msg=result["errmsg"]) | |
17 | + menlist = result['result']['list'] | |
18 | + mennamelist = [] | |
19 | + for i in range(len(menlist)): | |
20 | + menlist = result['result']['list'][i]['name'].split() | |
21 | + mennamelist[len(mennamelist):len(mennamelist)] = menlist | |
22 | + # print(mennamelist) | |
23 | + return mennamelist | |
24 | + | |
25 | + # 从人员姓名中获取一个人员的姓名 | |
26 | + def test_get_onename(self): | |
27 | + namelist = self.test_memnamelist() | |
28 | + x = random.randint(0, len(namelist)-1) | |
29 | + name = namelist[x] | |
30 | + print("从列表中取一个姓名: " + name) | |
31 | + return name | |
32 | + | |
33 | + # 获取员工列表接口 | |
34 | + def test_memlist(self): | |
35 | + url = '/contact/Apicp/User/DepartmentMember' | |
36 | + data = { | |
37 | + } | |
38 | + result = self.PcPost(url, data) | |
39 | + print('接口地址:' + self.host + self.domain + url) | |
40 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
41 | + list = result['result']['list'] | |
42 | + memberList = [] | |
43 | + for i in range(len(list)): | |
44 | + mem_Uid = result['result']['list'][i]['uid'].split() | |
45 | + memberList[len(memberList):len(memberList)] = mem_Uid | |
46 | + print(memberList) | |
47 | + return memberList | |
48 | + | |
49 | + def test_get_1menid(self): | |
50 | + memuidlist = self.test_memlist() | |
51 | + x = random.randint(0, len(memuidlist)-1) | |
52 | + menuid = memuidlist[x] | |
53 | + print("从列表中取一个用户Id: " + menuid) | |
54 | + return menuid | ... | ... |
tests/Staff_Management/MemberList/MemberList/test_memuid_list.py renamed to tests/Staff_Management/MemberList/MemberList/test_add_mem.py
... | ... | @@ -2,25 +2,19 @@ import unittest |
2 | 2 | from atdd.PcPost import PcPost |
3 | 3 | |
4 | 4 | |
5 | -class Memuid(PcPost): | |
5 | +class MemDetail(PcPost): | |
6 | 6 | def setUp(self): |
7 | 7 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
8 | 8 | |
9 | - # 员工列表接口 | |
10 | - def test_memlist(self): | |
11 | - url = '/contact/Apicp/User/DepartmentMember' | |
9 | + # 返回新增员工字段信息接口 | |
10 | + def test_memdetail(self): | |
11 | + url = '/contact/Apicp/User/AttributeInfo' | |
12 | 12 | data = { |
13 | 13 | } |
14 | 14 | result = self.PcPost(url, data) |
15 | 15 | print('接口地址:' + self.host + self.domain + url) |
16 | 16 | self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) |
17 | - list = result['result']['list'] | |
18 | - memberList = [] | |
19 | - for i in range(len(list)): | |
20 | - mem_Uid = result['result']['list'][i]['uid'].split() | |
21 | - memberList[len(memberList):len(memberList)] = mem_Uid | |
22 | - print(memberList) | |
23 | - return memberList | |
17 | + # print(result) | |
24 | 18 | |
25 | 19 | if __name__ == '__main__': |
26 | 20 | unittest.main() | ... | ... |
tests/Staff_Management/MemberList/MemberList/test_delete_mem.py deleted
100644 → 0
tests/Staff_Management/MemberList/MemberList/test_detail_mem.py
... | ... | @@ -13,7 +13,8 @@ class MemDetail(PcPost): |
13 | 13 | } |
14 | 14 | result = self.PcPost(url, data) |
15 | 15 | print('接口地址:' + self.host + self.domain + url) |
16 | - self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) # limit判断? 判断通过打印? | |
16 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
17 | + self.assertEqual(0, result['errcode'], msg=result['errcode']) | |
17 | 18 | # print(result) |
18 | 19 | |
19 | 20 | if __name__ == '__main__': | ... | ... |
tests/Staff_Management/MemberList/MemberList/test_memlist_mem.py
... | ... | @@ -7,12 +7,12 @@ class ReadMemList(PcPost): |
7 | 7 | def setUp(self): |
8 | 8 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
9 | 9 | |
10 | + # 获取员工列表接口 | |
10 | 11 | def test_memlist(self): |
11 | 12 | url = "/contact/Apicp/User/DepartmentMember" |
12 | 13 | data = { |
13 | 14 | } |
14 | 15 | result = self.PcPost(url, data) |
15 | 16 | print(self.host + '/' + self.domain + url) |
16 | - self.assertEqual("ok", result["errmsg"], msg=result["errmsg"]) # 怎样断言返回结果中的limit(动态)数据? | |
17 | - print(result) | |
17 | + self.assertEqual("ok", result["errmsg"], msg=result["errmsg"]) | |
18 | 18 | return result | ... | ... |
tests/Staff_Management/MemberList/MemberList/test_search_mem.py
1 | 1 | import unittest |
2 | 2 | from atdd.PcPost import PcPost |
3 | +from tests.Staff_Management.MemberList.MemberList.get_menInf import GetMemInf | |
4 | +from tests.Staff_Management.MemberList.JobList.get_jobid import JobId | |
5 | +from tests.Staff_Management.Organization.public_org import PulbicOrg | |
3 | 6 | |
4 | 7 | |
5 | 8 | class SearchMem(PcPost): |
6 | 9 | |
10 | + url = '/contact/Apicp/User/DepartmentMember' | |
11 | + | |
7 | 12 | def setUp(self): |
8 | 13 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
9 | 14 | |
10 | 15 | # 全部列表 |
11 | 16 | def test_search_mem(self): |
12 | - url = '/contact/Apicp/User/DepartmentMember' | |
13 | 17 | data = { |
14 | 18 | } |
15 | - result = self.PcPost(url, data) | |
16 | - print('接口地址:' + self.host + '/' + self.domain + url) | |
19 | + result = self.PcPost(self.url, data) | |
20 | + print('接口地址:' + self.host + '/' + self.domain + self.url) | |
17 | 21 | # print(result) |
18 | 22 | return result |
19 | 23 | |
20 | 24 | # 按姓名搜索 |
21 | 25 | def test_search_name(self): |
22 | - url = '/contact/Apicp/User/DepartmentMember' | |
26 | + name = GetMemInf().test_get_onename() | |
23 | 27 | data = { |
24 | - 'name': '刘洋' | |
28 | + 'name': name | |
25 | 29 | } |
26 | - result = self.PcPost(url, data) | |
27 | - type(result) | |
28 | - print('接口地址: ' + self.host + '/' + self.domain + url) | |
30 | + result = self.PcPost(self.url, data) | |
31 | + print('接口地址: ' + self.host + '/' + self.domain + self.url) | |
29 | 32 | self.assertEqual(0, result['errcode'], msg=result['errcode']) |
30 | - # self.assertEqual('ok', result['errsdkcode'], msg=result['errsdkcode']) # 怎样断言返回结果中的limit(动态)数据? | |
33 | + # print(result) | |
31 | 34 | return result |
32 | 35 | |
33 | 36 | # 按手机号搜索 |
34 | 37 | def test_search_mobile(self): |
35 | - url = '/contact/Apicp/User/DepartmentMember' | |
36 | 38 | data = { |
37 | - 'mobile': 13818801804 | |
39 | + 'mobile': 13818801805 | |
38 | 40 | } |
39 | - result = self.PcPost(url, data) | |
40 | - print('接口地址:' + self.host + '/' + self.domain + url) | |
41 | + result = self.PcPost(self.url, data) | |
42 | + print('接口地址:' + self.host + '/' + self.domain + self.url) | |
41 | 43 | self.assertEqual(0, result['errcode'], msg=result['errcode']) |
42 | 44 | return result |
43 | 45 | |
44 | 46 | # 按角色搜索 |
45 | 47 | def test_search_role(self): |
46 | - url = '/contact/Apicp/User/DepartmentMember' | |
48 | + jobId = JobId().test_get_1jobid() | |
47 | 49 | data = { |
48 | - 'role_ids[0]': '755DE1EC0A69039F18591A299B47E6F3' # 需动态获取角色列表数据作为参数读取 | |
50 | + 'role_ids[0]': jobId | |
49 | 51 | } |
50 | - result = self.PcPost(url, data) | |
52 | + result = self.PcPost(self.url, data) | |
51 | 53 | self.assertEqual(0, result['errcode'], msg=result['errcode']) |
52 | - print(result) # 返回结果待验证? | |
53 | 54 | return result |
54 | 55 | |
56 | + # 按组织搜索 | |
57 | + def test_search_org(self): | |
58 | + orgId = PulbicOrg().get_random_dptId() | |
59 | + data = { | |
60 | + 'role_ids[0]': orgId | |
61 | + } | |
62 | + result = self.PcPost(self.url, data) | |
63 | + self.assertEqual(0, result['errcode'], msg=result['errcode']) | |
64 | + print(data) | |
65 | + return result | |
55 | 66 | |
56 | 67 | if __name__ == '__main__': |
57 | 68 | unittest.main() | ... | ... |
tests/Staff_Management/MemberList/RoleList/test_add_role.py
0 → 100644
1 | +import unittest | |
2 | +from atdd.PcPost import PcPost | |
3 | +import random | |
4 | + | |
5 | + | |
6 | +class Addrole(PcPost): | |
7 | + name = random.randint(1, 10000) | |
8 | + url = '/Contact/Apicp/Role/Add' | |
9 | + | |
10 | + def setUp(self): | |
11 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
12 | + | |
13 | + # 正常添加岗位信息 | |
14 | + def test_addrole(self): | |
15 | + data = { | |
16 | + 'roleName': 'AddroleApi' + str(self.name) | |
17 | + } | |
18 | + result = self.PcPost(self.url, data) | |
19 | + print('接口地址:' + self.host + self.domain + self.url) | |
20 | + self.assertEqual('ok', result['errmsg'], msg=result['errmsg']) | |
21 | + roldId = result['result']['roleId'] | |
22 | + # print('成功生成岗位!岗位ID:' + roleId) | |
23 | + return result | |
24 | + | |
25 | +if __name__ == '__main__': | |
26 | + unittest.main() | ... | ... |
tests/Staff_Management/MemberList/JobList/test_roleId_jobid.py renamed to tests/Staff_Management/MemberList/RoleList/test_roleId.py
... | ... | @@ -21,20 +21,6 @@ class RoleId(PcPost): |
21 | 21 | print(roleidlist) |
22 | 22 | return roleidlist |
23 | 23 | |
24 | - # 获取岗位列表 | |
25 | - def test_get_jobid(self): | |
26 | - url = '/Contact/Apicp/Job/List' | |
27 | - data = { | |
28 | - } | |
29 | - result = self.PcPost(url, data) | |
30 | - resultlist = result['result']['list'] | |
31 | - jobIdlist = [] | |
32 | - for i in range(len(resultlist)): | |
33 | - jobId = result['result']['list'][i]['jobId'].split() | |
34 | - jobIdlist[len(jobIdlist):len(jobIdlist)] = jobId | |
35 | - print(jobIdlist) | |
36 | - return jobIdlist | |
37 | - | |
38 | 24 | |
39 | 25 | if __name__ == '__main__': |
40 | 26 | unittest.main() | ... | ... |