Commit 57515b139d0578aa9ec636bfb7fecbe310ada627
1 parent
91261ae9
invite
Showing
10 changed files
with
228 additions
and
14 deletions
README.md
... | ... | @@ -38,4 +38,11 @@ git rebase feature/jipeihong |
38 | 38 | |
39 | 39 | rebase没问题就可以继续前面的git push命令了。 |
40 | 40 | |
41 | -rebase有问题的话需要解决下冲突。 | |
42 | 41 | \ No newline at end of file |
42 | +rebase有问题的话需要解决下冲突。 | |
43 | + | |
44 | +编码注意: | |
45 | +1、Python测试文件前以'test_'命名; | |
46 | +2、类之前不需要test,类名首字母大写; | |
47 | +3、单词分割线用英文下划线‘_’,不要用中间线“-”; | |
48 | +4、随机函数random; | |
49 | +5、接口返回结果格式转换,以及结果中所需值的提取; | |
43 | 50 | \ No newline at end of file | ... | ... |
tests/Staff_Management/AdminSettings/public_adminSettings.py
0 → 100644
tests/Staff_Management/AdminSettings/test_jobSetting.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | + | |
3 | +class JobSetting(PcPost): | |
4 | + def setUp(self): | |
5 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
6 | + | |
7 | + # 岗位list——岗位管理页面 | |
8 | + def test_getJobList(self): | |
9 | + interfaceUrl = "/Contact/Apicp/Job/List" | |
10 | + data = { | |
11 | + "page": 1, | |
12 | + "limit": 10 | |
13 | + } | |
14 | + result = self.PcPost(interfaceUrl,data) | |
15 | + return result | |
16 | + | |
17 | + # 获取所有岗位的ID,以list格式返回 | |
18 | + def get_all_jobId(self): | |
19 | + jobList = self.test_getJobList()['result']['list'] | |
20 | + jobIdList = [] | |
21 | + for i in range(len(jobList)): | |
22 | + jobId = jobList[i]['jobId'].split() | |
23 | + # 将jobId加入到jobIdList中 | |
24 | + jobIdList[len(jobIdList):len(jobIdList)] = jobId | |
25 | + return jobIdList | |
26 | + | |
27 | + # 根据岗位名称获取岗位ID | |
28 | + def getJobID(self, jobName): | |
29 | + jobList = self.test_getJobList()['result']['list'] | |
30 | + for i in range(len(jobList)): | |
31 | + if (jobList[i]['jobName'] == jobName): | |
32 | + jobId = jobList[i]['jobId'] | |
33 | + else: | |
34 | + jobId = None | |
35 | + return jobId | |
36 | + | ... | ... |
tests/Staff_Management/AdminSettings/test_roleSetting.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | + | |
3 | +class RoleSetting(PcPost): | |
4 | + def setUp(self): | |
5 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
6 | + | |
7 | + # 角色list——角色管理页面 | |
8 | + def test_getRoleList(self): | |
9 | + interfaceUrl = "/Contact/Apicp/Role/List" | |
10 | + data = { | |
11 | + "page": 1, | |
12 | + "limit": 10 | |
13 | + } | |
14 | + result = self.PcPost(interfaceUrl,data) | |
15 | + return result | |
16 | + | |
17 | + # 获取所有角色的ID,以list格式返回 | |
18 | + def get_all_roleId(self): | |
19 | + roleList = self.test_getRoleList()['result']['list'] | |
20 | + roleIdList = [] | |
21 | + for i in range(len(roleList)): | |
22 | + jobId = roleList[i]['roleId'].split() | |
23 | + # 将jobId加入到jobIdList中 | |
24 | + roleIdList[len(roleIdList):len(roleIdList)] = jobId | |
25 | + return roleIdList | |
26 | + | |
27 | + # 根据角色名称获取角色ID | |
28 | + def getRoleID(self, roleName): | |
29 | + roleList = self.test_getRoleList()['result']['list'] | |
30 | + for i in range(len(roleList)): | |
31 | + if (roleList[i]['roleName'] == roleName): | |
32 | + roleId = roleList[i]['roleId'] | |
33 | + else: | |
34 | + roleId = None | |
35 | + return roleId | |
36 | + | ... | ... |
tests/Staff_Management/Invite/test_InvitationLetters.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | + | |
3 | +class InvitationLetter(PcPost): | |
4 | + | |
5 | + interfaceUrl = "/contact/Apicp/Invite/Save" | |
6 | + | |
7 | + def setUp(self): | |
8 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
9 | + | |
10 | + def test_invitationLetter(self): | |
11 | + data = { | |
12 | + "content": "<p>欢迎加入【小仙女】!</p><p>这里是学习成长赋能新平台,深度整合公司资料、知识、技能、能力测评以及各种好" | |
13 | + "玩的活动和服务,真正帮助大家达到能力提升、快速高效提高工作效能。</p><p>大家可以通过碎片化时间随时随地参与" | |
14 | + "学习各种新知识、技能,了解公司新动态,公司构建平台的目的是希望同事们可以互动沟通,人人学习、人人分享,大家" | |
15 | + "一起享受企业赋能的无限可能。</p><p>打通员工、公司总部、培训管理之间的时空距离,提升大家学习成长体验,打造" | |
16 | + "不一样的共同成长氛围。333</p>", | |
17 | + "share_content": "点击链接加入“【小仙女】”,一起享受企业赋能之旅吧。222" | |
18 | + } | |
19 | + result = self.PcPost(self.interfaceUrl,data) | |
20 | + return result | |
21 | + | |
22 | + | ... | ... |
tests/Staff_Management/Invite/test_Invitation_authority.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | +from tests.Staff_Management.AdminSettings.test_jobSetting import JobSetting | |
3 | +from tests.Staff_Management.AdminSettings.test_roleSetting import RoleSetting | |
4 | +import random | |
5 | + | |
6 | +class InvitationAuth(PcPost): | |
7 | + | |
8 | + interfaceUrl = "/Public/Apicp/ChooseMem/ConfirmChoose" | |
9 | + | |
10 | + def setUp(self): | |
11 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
12 | + | |
13 | + # 选择成员 | |
14 | + def test_invitationauth_mem(self): | |
15 | + data = { | |
16 | + "_identifier": "yuanquan", | |
17 | + "memArray[0][memID]": self.jipeihong_uid | |
18 | + } | |
19 | + result = self.PcPost(self.interfaceUrl,data) | |
20 | + print(result) | |
21 | + return result | |
22 | + | |
23 | + # 选择岗位 | |
24 | + def test_invitationauth_job(self): | |
25 | + jobIdList = JobSetting().get_all_jobId() | |
26 | + x = random.randint(0,len(jobIdList)-1) | |
27 | + data = { | |
28 | + "_identifier": "yuanquan", | |
29 | + "jobArray[0][jobID]": jobIdList[x] | |
30 | + } | |
31 | + result = self.PcPost(self.interfaceUrl,data) | |
32 | + print(result) | |
33 | + return result | |
34 | + | |
35 | + # 选择角色 | |
36 | + def test_invitationauth_role(self): | |
37 | + roleIdList = RoleSetting().get_all_roleId() | |
38 | + x = random.randint(0,len(roleIdList)-1) | |
39 | + data = { | |
40 | + "_identifier": "yuanquan", | |
41 | + "roleArray[0][roleID]": roleIdList[x] | |
42 | + } | |
43 | + result = self.PcPost(self.interfaceUrl,data) | |
44 | + print(result) | |
45 | + return result | |
46 | + | ... | ... |
tests/Staff_Management/Organization/public_org.py
... | ... | @@ -2,7 +2,9 @@ |
2 | 2 | from atdd.PcPost import PcPost |
3 | 3 | |
4 | 4 | class PulbicOrg(PcPost): |
5 | + url_ListChildren = "/Contact/Apicp/Department/ListChildren" | |
5 | 6 | |
7 | + # 获取顶级部门的ID | |
6 | 8 | def get_top_org(self): |
7 | 9 | url = "/Contact/Apicp/Department/List" |
8 | 10 | data = { |
... | ... | @@ -13,13 +15,12 @@ class PulbicOrg(PcPost): |
13 | 15 | top_dpId = result['result']['list'][0]['dpId'] |
14 | 16 | return top_dpId |
15 | 17 | |
16 | - # 查找所有部门的dpId,包括顶级部门,以list格式返回 | |
17 | - def get_all_dpId(self): | |
18 | - url = "/Contact/Apicp/Department/ListChildren" | |
18 | + # 查找某一个部门以及其子部门的dpId,以list格式返回 | |
19 | + def get_all_dpId(self,dpParentId): | |
19 | 20 | data = { |
20 | - "dpParentId":self.get_top_org() | |
21 | + "dpParentId":dpParentId | |
21 | 22 | } |
22 | - result = self.PcPost(url,data) | |
23 | + result = self.PcPost(self.url_ListChildren,data) | |
23 | 24 | orglist = result['result']['list'] # 组织列表的list信息 |
24 | 25 | dpIdList = [] |
25 | 26 | for i in range(len(orglist)): |
... | ... | @@ -28,6 +29,16 @@ class PulbicOrg(PcPost): |
28 | 29 | dpIdList[len(dpIdList):len(dpIdList)] = dpId |
29 | 30 | return dpIdList |
30 | 31 | |
32 | + # 获取组织下的人员总数 | |
33 | + def get_org_user_total(self,dpParentId): | |
34 | + data = { | |
35 | + "dpParentId": dpParentId | |
36 | + } | |
37 | + result = self.PcPost(self.url_ListChildren,data) | |
38 | + user_total = result['result']['list'][0]['user_total'] | |
39 | + return user_total | |
40 | + | |
41 | + | |
31 | 42 | |
32 | 43 | |
33 | 44 | ... | ... |
tests/Staff_Management/Organization/test_DepartmentMember.py
0 → 100644
1 | +from atdd.PcPost import PcPost | |
2 | +from tests.Staff_Management.Organization.public_org import PulbicOrg | |
3 | +import random | |
4 | + | |
5 | +# 点击组织,跳转至人员列表页面,即查询该组织下的人员情况 | |
6 | +class DepartmentMember(PcPost): | |
7 | + | |
8 | + interfaceUrl = "/contact/Apicp/User/DepartmentMember" | |
9 | + | |
10 | + def setUp(self): | |
11 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | |
12 | + | |
13 | + def test_departmentMember(self): | |
14 | + top_Id = PulbicOrg().get_top_org() | |
15 | + dpId_all = PulbicOrg().get_all_dpId(top_Id) # 所有部门的dpId | |
16 | + x = random.randint(0, len(dpId_all) - 1) # 在所有部门中随机取一个部门 | |
17 | + data = { | |
18 | + "department_id[0]": dpId_all[x] | |
19 | + } | |
20 | + result = self.PcPost(self.interfaceUrl,data) | |
21 | + print(result) | |
0 | 22 | \ No newline at end of file | ... | ... |
tests/Staff_Management/Organization/test_add_org.py
... | ... | @@ -11,6 +11,8 @@ class AddOrg(PcPost): |
11 | 11 | def setUp(self): |
12 | 12 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
13 | 13 | |
14 | + | |
15 | + # 添加非门店 | |
14 | 16 | def test_add_org(self): |
15 | 17 | x = random.randint(0,1000) |
16 | 18 | top_dpId = PulbicOrg().get_top_org() |
... | ... | @@ -26,4 +28,31 @@ class AddOrg(PcPost): |
26 | 28 | } |
27 | 29 | result = self.PcPost(self.interfaceUrl,data) |
28 | 30 | print(result) |
29 | - return result | |
30 | 31 | \ No newline at end of file |
32 | + return result | |
33 | + | |
34 | + # 新增门店 | |
35 | + def test_add_mendian(self): | |
36 | + x = random.randint(0,1000) | |
37 | + top_dpId = PulbicOrg().get_top_org() | |
38 | + data = { | |
39 | + "department_id": None, | |
40 | + "parent_id": top_dpId, # 顶级部门 | |
41 | + "dp_name": "门店"+ str(x), | |
42 | + "is_all": 1, | |
43 | + "is_dept": 0, | |
44 | + "extList[755DD98A0A69039F18591A29234CC182]": 1, | |
45 | + "extList[755DD98B0A69039F18591A29737749E6]": 2, | |
46 | + "extList[755DD98C0A69039F18591A295933D690]": 1, | |
47 | + "extList[755DD98D0A69039F18591A2959748F91][province]": "山西省", | |
48 | + "extList[755DD98D0A69039F18591A2959748F91][city]": "晋城市", | |
49 | + "extList[755DD98D0A69039F18591A2959748F91][town]": "泽州县", | |
50 | + "extList[755DD98E0A69039F18591A2935DC27D1]": 222, | |
51 | + "extList[755DD98F0A69039F18591A2929431878]": 222, | |
52 | + "extList[755DD9900A69039F18591A298A2C8C20]": 22222, | |
53 | + "extList[755DD9920A69039F18591A29EFFCB47E]": 222, | |
54 | + "dpt_id": "755DD9880A69039F18591A294E089AC7", | |
55 | + "dp_serial_num": 33, | |
56 | + "dp_leader_uids[0]": self.jipeihong_uid | |
57 | + } | |
58 | + result = self.PcPost(self.interfaceUrl,data) | |
59 | + print(result) | ... | ... |
tests/Staff_Management/Organization/test_delete_org.py
... | ... | @@ -12,19 +12,22 @@ class DeleteOrg(PcPost): |
12 | 12 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
13 | 13 | |
14 | 14 | def test_delete_org(self): |
15 | - dpIdList = PulbicOrg().get_all_dpId() | |
16 | - if len(dpIdList)>1: | |
17 | - x = random.randint(0,len(dpIdList)-2) #从第一个组织ID到倒数第二个组织ID,去掉顶级部门 | |
15 | + top_Id = PulbicOrg().get_top_org() | |
16 | + dpId_all = PulbicOrg().get_all_dpId(top_Id) # 所有部门的dpId | |
17 | + x = random.randint(0, len(dpId_all)-1) # 在所有部门中随机取一个部门 | |
18 | + dpIdList = PulbicOrg().get_all_dpId(dpId_all[x]) #获取该部门以及子部门的ID | |
19 | + user_total = PulbicOrg().get_org_user_total(dpId_all[x]) # 获取该该部门的人员总数 | |
20 | + if len(dpIdList)>1 or user_total>0 or len(dpId_all)==1 : # 如果存在子部门或人员 或只剩下顶级部门 | |
21 | + code = 700 | |
18 | 22 | data = { |
19 | 23 | "department_id": dpIdList[x] |
20 | 24 | } |
21 | - result = self.PcPost(self.interfaceUrl,data) | |
22 | - else: # 删除顶级部门 | |
23 | - code = 700 | |
25 | + result = self.PcPostAbnormal(self.interfaceUrl,data,code) | |
26 | + else: # 删除非顶级部门,且部门下无子部门和人员 | |
24 | 27 | data = { |
25 | 28 | "department_id": dpIdList[0] #顶级部门 |
26 | 29 | } |
27 | - result = self.PcPostAbnormal(self.interfaceUrl,data,code) | |
30 | + result = self.PcPost(self.interfaceUrl,data) | |
28 | 31 | print(result) |
29 | 32 | return result |
30 | 33 | ... | ... |