test_Get_level_rule_details.py
2.68 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
import unittest
from atdd.PcApiTest import PcApiTest
import os
# 获取企业计算等级规则明细
class Getleveldetail(PcApiTest):
def setUp(self):
user = self.do_login('https://dengta.vchangyi.com', '13818801804', '123123',
domain='wx5019b9c455ea9c81')
# 无参数>>提示计算类型不能为空
def test_detail_all(self):
url = self.host + "/" + self.domain + "/Integral/Apicp/Level/List"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {
}
r = self.post(url=url, headers=headers, data=data)
print(r.text)
data = r.json()
print(self.host + '/' + self.domain + '/Integral/Apicp/Level/GetDefaultLevel')
self.assertEqual(2074050, data["errcode"], msg=data["errcode"])
self.assertEqual("积分等级计算类型不能为空", data["errmsg"], msg=data["errmsg"])
# 积分等级计算类型:默认
def test_detail_default(self):
url = self.host + "/" + self.domain + "/Integral/Apicp/Level/List"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {
"eilType": 0
}
r = self.post(url=url, headers=headers, data=data)
print(r.text)
data = r.json()
print(self.host + '/' + self.domain + '/Integral/Apicp/Level/GetDefaultLevel')
self.assertEqual(0, data["errcode"], msg=data["errcode"])
self.assertEqual("ok", data["errmsg"], msg=data["errmsg"])
# 积分等级计算类型:按岗位
def test_detail_job(self):
url = self.host + "/" + self.domain + "/Integral/Apicp/Level/List"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
filepath = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) + '/Integral/data/parameter/csh.txt'
with open(filepath, 'r') as r:
eliType = r.readlines()[0]
data = {
"eilType": eliType
}
r = self.post(url, headers=headers, data=data)
print(r.text)
# 积分等级计算类型:按角色
def test_detail_role(self):
url = self.host + "/" + self.domain + "/Integral/Apicp/Level/List"
headers = {"Content-Type": "application/x-www-form-urlencoded"}
data = {
"eilType": 2
}
r = self.post(url=url, headers=headers, data=data)
print(r.text)
data = r.json()
print(self.host + '/' + self.domain + '/Integral/Apicp/Level/GetDefaultLevel')
self.assertEqual(0, data["errcode"], msg=data["errcode"])
self.assertEqual("ok", data["errmsg"], msg=data["errmsg"])
if __name__ == '__main__':
unittest.main()