Commit 05e0315a3c9871ac279b173fd3db13d0aab24db2
Merge branch 'feature/jipeihong' into 'master'
Feature/jipeihong See merge request !11
Showing
9 changed files
with
199 additions
and
14 deletions
atdd/ATDDCase.py
@@ -18,7 +18,7 @@ class ATDDCase(unittest.TestCase): | @@ -18,7 +18,7 @@ class ATDDCase(unittest.TestCase): | ||
18 | 18 | ||
19 | 19 | ||
20 | mobile = '17321009308' | 20 | mobile = '17321009308' |
21 | - psw = '123456' | 21 | + psw = '222222' |
22 | jipeihong_uid = '755DE0550A69039F0BA12102F4A4F8E1' # 季培红的UID | 22 | jipeihong_uid = '755DE0550A69039F0BA12102F4A4F8E1' # 季培红的UID |
23 | cert = ('1_vchangyi.com_bundle.crt', '2_vchangyi.com.key') | 23 | cert = ('1_vchangyi.com_bundle.crt', '2_vchangyi.com.key') |
24 | 24 |
atdd/PcPost.py
@@ -10,7 +10,7 @@ class PcPost(ATDDCase): | @@ -10,7 +10,7 @@ class PcPost(ATDDCase): | ||
10 | result = data['result'] | 10 | result = data['result'] |
11 | 11 | ||
12 | if isinstance(result, list): | 12 | if isinstance(result, list): |
13 | - user = result[1] | 13 | + user = result[0] |
14 | if len(result) > 1: | 14 | if len(result) > 1: |
15 | print("选择企业:", user['enterpriseInfo']['epName']) | 15 | print("选择企业:", user['enterpriseInfo']['epName']) |
16 | 16 |
tests/Staff_Management/AdminSettings/Staff_attribute/test_add_Attribute.py
0 → 100644
1 | +from atdd.PcPost import PcPost | ||
2 | +import random | ||
3 | + | ||
4 | +# 新增员工属性 | ||
5 | + | ||
6 | +class AddAttribute(PcPost): | ||
7 | + | ||
8 | + interfaceUrl = "/contact/Apicp/Attribute/Save" | ||
9 | + | ||
10 | + # 0~10000的随机整数 | ||
11 | + x = random.randint(0, 10000) | ||
12 | + | ||
13 | + def setUp(self): | ||
14 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | ||
15 | + | ||
16 | + # 新增单行文本属性 | ||
17 | + def test_add_text(self): | ||
18 | + data = { | ||
19 | + "attr_name": "单行文本"+str(self.x), | ||
20 | + "position": 0, | ||
21 | + "type": 1, #类型为单行文本 | ||
22 | + "order": 0, | ||
23 | + "is_system": 0, | ||
24 | + "is_open_cp": 1, | ||
25 | + "is_open_cp_edit": 0, | ||
26 | + "is_open": 1, | ||
27 | + "is_open_edit": 0, | ||
28 | + "is_required_cp": 0, | ||
29 | + "is_required_cp_edit": 0, | ||
30 | + "is_required": 0, | ||
31 | + "is_required_edit": 0, | ||
32 | + "is_show": 1, | ||
33 | + "is_show_edit": 0 | ||
34 | + } | ||
35 | + result = self.PcPost(self.interfaceUrl,data) | ||
36 | + return result | ||
37 | + | ||
38 | + # 新增多行文本 | ||
39 | + def test_add_MultilineText(self): | ||
40 | + data = { | ||
41 | + "attr_name": "多行文本" + str(self.x), | ||
42 | + "position": 0, | ||
43 | + "type": 2, #类型为多行文本 | ||
44 | + "order": 0, | ||
45 | + "is_system": 0, | ||
46 | + "is_open_cp": 1, | ||
47 | + "is_open_cp_edit": 0, | ||
48 | + "is_open": 1, | ||
49 | + "is_open_edit": 0, | ||
50 | + "is_required_cp": 0, | ||
51 | + "is_required_cp_edit": 0, | ||
52 | + "is_required": 0, | ||
53 | + "is_required_edit": 0, | ||
54 | + "is_show": 1, | ||
55 | + "is_show_edit": 0 | ||
56 | + } | ||
57 | + result = self.PcPost(self.interfaceUrl, data) | ||
58 | + return result | ||
59 | + | ||
60 | + # 新增日期 | ||
61 | + def test_add_Date(self): | ||
62 | + data = { | ||
63 | + "attr_name": "日期" + str(self.x), | ||
64 | + "position": 0, | ||
65 | + "type": 4, # 类型为日期 | ||
66 | + "order": 0, | ||
67 | + "is_system": 0, | ||
68 | + "is_open_cp": 1, | ||
69 | + "is_open_cp_edit": 0, | ||
70 | + "is_open": 1, | ||
71 | + "is_open_edit": 0, | ||
72 | + "is_required_cp": 0, | ||
73 | + "is_required_cp_edit": 0, | ||
74 | + "is_required": 0, | ||
75 | + "is_required_edit": 0, | ||
76 | + "is_show": 1, | ||
77 | + "is_show_edit": 0 | ||
78 | + } | ||
79 | + result = self.PcPost(self.interfaceUrl, data) | ||
80 | + return result | ||
81 | + | ||
82 | + # 新建单选 | ||
83 | + def test_add_singleSelect(self): | ||
84 | + data = { | ||
85 | + "option[0][name]": "漂亮", | ||
86 | + "option[0][value]": 0, | ||
87 | + "option[1][name]": "可爱", | ||
88 | + "option[1][value]": 1, | ||
89 | + "option[2][name]": "任性", | ||
90 | + "option[2][value]": 2, | ||
91 | + "option[3][name]": "有钱", | ||
92 | + "option[3][value]": 3, | ||
93 | + "attr_name": "单选" + str(self.x), | ||
94 | + "position": 0, | ||
95 | + "type": 7, # 类型为单选 | ||
96 | + "order": 0, | ||
97 | + "is_system": 0, | ||
98 | + "is_open_cp": 1, | ||
99 | + "is_open_cp_edit": 0, | ||
100 | + "is_open": 1, | ||
101 | + "is_open_edit": 0, | ||
102 | + "is_required_cp": 0, | ||
103 | + "is_required_cp_edit": 0, | ||
104 | + "is_required": 0, | ||
105 | + "is_required_edit": 0, | ||
106 | + "is_show": 1, | ||
107 | + "is_show_edit": 0 | ||
108 | + } | ||
109 | + result = self.PcPost(self.interfaceUrl, data) | ||
110 | + return result | ||
111 | + | ||
112 | + # 新建多选 | ||
113 | + def test_add_multiSelect(self): | ||
114 | + data = { | ||
115 | + "option[0][name]": "漂亮", | ||
116 | + "option[0][value]": 0, | ||
117 | + "option[1][name]": "可爱", | ||
118 | + "option[1][value]": 1, | ||
119 | + "option[2][name]": "任性", | ||
120 | + "option[2][value]": 2, | ||
121 | + "option[3][name]": "有钱", | ||
122 | + "option[3][value]": 3, | ||
123 | + "attr_name": "多选" + str(self.x), | ||
124 | + "position": 0, | ||
125 | + "type": 8, # 类型为多选 | ||
126 | + "order": 0, | ||
127 | + "is_system": 0, | ||
128 | + "is_open_cp": 1, | ||
129 | + "is_open_cp_edit": 0, | ||
130 | + "is_open": 1, | ||
131 | + "is_open_edit": 0, | ||
132 | + "is_required_cp": 0, | ||
133 | + "is_required_cp_edit": 0, | ||
134 | + "is_required": 0, | ||
135 | + "is_required_edit": 0, | ||
136 | + "is_show": 1, | ||
137 | + "is_show_edit": 0 | ||
138 | + } | ||
139 | + result = self.PcPost(self.interfaceUrl, data) | ||
140 | + return result |
tests/Staff_Management/Organization/public_org.py
1 | 1 | ||
2 | from atdd.PcPost import PcPost | 2 | from atdd.PcPost import PcPost |
3 | +import random | ||
3 | 4 | ||
4 | class PulbicOrg(PcPost): | 5 | class PulbicOrg(PcPost): |
5 | url_ListChildren = "/Contact/Apicp/Department/ListChildren" | 6 | url_ListChildren = "/Contact/Apicp/Department/ListChildren" |
@@ -38,8 +39,9 @@ class PulbicOrg(PcPost): | @@ -38,8 +39,9 @@ class PulbicOrg(PcPost): | ||
38 | user_total = result['result']['list'][0]['user_total'] | 39 | user_total = result['result']['list'][0]['user_total'] |
39 | return user_total | 40 | return user_total |
40 | 41 | ||
41 | - | ||
42 | - | ||
43 | - | ||
44 | - | ||
45 | - | 42 | + # 随机取一个部门,返回部门ID |
43 | + def get_random_dptId(self): | ||
44 | + top_Id = self.get_top_org() | ||
45 | + dpId_all = self.get_all_dpId(top_Id) # 所有部门的dpId | ||
46 | + x = random.randint(0, len(dpId_all) - 1) # 在所有部门中随机取一个部门 | ||
47 | + return dpId_all[x] | ||
46 | \ No newline at end of file | 48 | \ No newline at end of file |
tests/Staff_Management/Organization/test_add_org.py
@@ -14,7 +14,7 @@ class AddOrg(PcPost): | @@ -14,7 +14,7 @@ class AddOrg(PcPost): | ||
14 | 14 | ||
15 | # 添加非门店 | 15 | # 添加非门店 |
16 | def test_add_org(self): | 16 | def test_add_org(self): |
17 | - x = random.randint(0,1000) | 17 | + x = random.randint(0,10000) |
18 | top_dpId = PulbicOrg().get_top_org() | 18 | top_dpId = PulbicOrg().get_top_org() |
19 | data = { | 19 | data = { |
20 | "department_id": None, | 20 | "department_id": None, |
tests/Staff_Management/Organization/test_changeOrder.py
0 → 100644
1 | +from atdd.PcPost import PcPost | ||
2 | +from tests.Staff_Management.Organization.public_org import PulbicOrg | ||
3 | + | ||
4 | +class ChangeOrder(PcPost): | ||
5 | + | ||
6 | + interfaceUrl = "/Contact/Apicp/Department/ChangeOrder" | ||
7 | + | ||
8 | + def setUp(self): | ||
9 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | ||
10 | + | ||
11 | + def test_changeOrder(self): | ||
12 | + # 随机取一个部门 | ||
13 | + dptId = PulbicOrg().get_random_dptId() | ||
14 | + data = { | ||
15 | + "department_id": dptId, | ||
16 | + "order":12 | ||
17 | + } | ||
18 | + result = self.PcPost(self.interfaceUrl,data) | ||
19 | + print(result) | ||
20 | + return result | ||
21 | + |
tests/Staff_Management/Organization/test_DepartmentMember.py renamed to tests/Staff_Management/Organization/test_departmentMember.py
1 | from atdd.PcPost import PcPost | 1 | from atdd.PcPost import PcPost |
2 | from tests.Staff_Management.Organization.public_org import PulbicOrg | 2 | from tests.Staff_Management.Organization.public_org import PulbicOrg |
3 | -import random | 3 | + |
4 | 4 | ||
5 | # 点击组织,跳转至人员列表页面,即查询该组织下的人员情况 | 5 | # 点击组织,跳转至人员列表页面,即查询该组织下的人员情况 |
6 | class DepartmentMember(PcPost): | 6 | class DepartmentMember(PcPost): |
@@ -11,11 +11,10 @@ class DepartmentMember(PcPost): | @@ -11,11 +11,10 @@ class DepartmentMember(PcPost): | ||
11 | self.do_login(self.host, self.mobile, self.psw, self.domain) | 11 | self.do_login(self.host, self.mobile, self.psw, self.domain) |
12 | 12 | ||
13 | def test_departmentMember(self): | 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) # 在所有部门中随机取一个部门 | 14 | + # 随机取一个部门ID |
15 | + dptId = PulbicOrg().get_random_dptId() | ||
17 | data = { | 16 | data = { |
18 | - "department_id[0]": dpId_all[x] | 17 | + "department_id[0]": dptId |
19 | } | 18 | } |
20 | result = self.PcPost(self.interfaceUrl,data) | 19 | result = self.PcPost(self.interfaceUrl,data) |
21 | print(result) | 20 | print(result) |
22 | \ No newline at end of file | 21 | \ No newline at end of file |
tests/Staff_Management/Organization/test_search_org.py
@@ -14,7 +14,7 @@ class SearchOrg(PcPost): | @@ -14,7 +14,7 @@ class SearchOrg(PcPost): | ||
14 | # 搜索存在的组织 | 14 | # 搜索存在的组织 |
15 | def test_search_org(self): | 15 | def test_search_org(self): |
16 | data = { | 16 | data = { |
17 | - "keyword": 123 | 17 | + "keyword": '小仙女' |
18 | } | 18 | } |
19 | result = self.PcPost(self.interfaceUrl,data) | 19 | result = self.PcPost(self.interfaceUrl,data) |
20 | print(result) | 20 | print(result) |
tests/Staff_Management/Organization/tets_edit_org.py
0 → 100644
1 | +from atdd.PcPost import PcPost | ||
2 | +from tests.Staff_Management.Organization.public_org import PulbicOrg | ||
3 | + | ||
4 | + | ||
5 | +# 编辑组织 | ||
6 | +class EditOrg(PcPost): | ||
7 | + | ||
8 | + interfaceUrl = "/contact/Apicp/Department/EditQuery" | ||
9 | + | ||
10 | + def setUp(self): | ||
11 | + self.do_login(self.host, self.mobile, self.psw, self.domain) | ||
12 | + | ||
13 | + def test_edit_query(self): | ||
14 | + # 随机取一个部门ID | ||
15 | + dptId = PulbicOrg().get_random_dptId() | ||
16 | + | ||
17 | + data = { | ||
18 | + "department_id": dptId | ||
19 | + } | ||
20 | + result = self.PcPost(self.interfaceUrl,data) | ||
21 | + print(result) | ||
22 | + return result | ||
23 | + |