test_jobLevel.py
2.7 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
'''
Author: jipeigong 2017年7月19日17:53:38
'''
from atdd.PcApiTest import PcApiTest
from tests.Integral.IntergalPC.test_Integral import Integral
class jobLevel(PcApiTest):
#登录
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
# 获取企业计算等级规则明细——岗位
def test_levelList_job(self):
interfaceUrl = "/Integral/Apicp/Level/List"
data = {
"page": 1,
"limit": 10,
"eilType": "1", # 岗位
"pageNum": 1,
"pageSize": 999
}
result = self.PcApiTest(interfaceUrl, data)
print(result)
return result
#获取某岗位的岗位ID,等级ID
def get_levelInfo(self):
resultLevelList = self.test_levelList_job()
levelList = resultLevelList['result']['list']
for i in range(len(levelList)):
if (levelList[i]['objName'] == "季培红岗位"):
return levelList[i]['eilId'], levelList[i]['eilObjId']
else:
print("不存在“季培红岗位”!")
# 保存计算等级规则-岗位
def test_levelSave(self):
interfaceUrl = "/Integral/Apicp/Level/Save"
# 获取icon的ID和URL
uploadAtta = Integral().test_UploadAtta()
icon = uploadAtta['result']['atId']
iconUrl = uploadAtta['result']['atAttachment']
eilId = self.get_levelInfo()[0]
eilObjId = self.get_levelInfo()[1]
data = self.parse_array("eilLevelSetting", [
{
"name": "LV1",
"max": 100,
"icon": icon,
"iconUrl": iconUrl,
"iconType": "2"
},
{
"name": "LV10",
"max": -1,
"icon": icon,
"iconUrl": iconUrl,
"iconType": "2"
}])
data["eilId"] = eilId # 岗位等级ID
data["eilType"] = "1"
data["eilObjId"] = eilObjId # 季培红岗位ID
print(data)
result = self.PcApiTest(interfaceUrl,data)
print(result)
return result
# # 删除岗位等级-删除最后一个岗位等级
# def test_delete_job(self):
# interfaceUrl = "/Integral/Apicp/Level/Delete"
# resultJobLevel = self.test_levelList_job()
# listJobLevel = resultJobLevel['result']['list']
# self.assertNotEquals(1, len(listJobLevel))
# lastJobEIlId = listJobLevel[len(listJobLevel) - 1]['eilId'] # 最后一个岗位的等级ID
#
# data = {
# "eilId": lastJobEIlId
# }
# result = self.PcApiTest(interfaceUrl, data)
# print(result)
# return result