test_news_center.py
4.64 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import json
from atdd.ATDDCase import ATDDCase
from tests.Integral.publicMethods import PCpublicMethods
class NewsCenter(ATDDCase):
global list
url = ATDDCase().uc_host + '/a/' + ATDDCase().domain + '/' + ATDDCase().app + "/qy/integral/change"
businessKey = "news_center"
triggerKeyDict = PCpublicMethods.PCpublicMethods().getTriggerKey(businessKey)
triggerValueDict = PCpublicMethods.PCpublicMethods().getTriggerValue(businessKey)
def setUp(self):
pass
# 新闻资讯-分享
def test_shared(self):
print(self.triggerKeyDict)
data = {
"memUid": self.jipeihong_uid,
"businessKey": self.businessKey,
"businessAct": "shared",
"remark": "新闻资讯-分享",
"businessId": "55",
"triggerTypes": [
{
"triggerKey": "shared_num", #次数(循环类型) 全局
"value": 2
}
]
}
result = self.post(self.url, json.dumps(data), headers=self.header_json)
code = result.json()['code']
print(result.json())
self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN') # 积分策略没有启用
self.assertEquals(code,'SUCCESS')
# 新闻资讯-评论
def test_comment(self):
print(self.triggerKeyDict)
data = {
"memUid": self.jipeihong_uid,
"businessKey": self.businessKey,
"businessAct": "comment",
"remark": "新闻资讯-评论",
"businessId": "55",
"triggerTypes": [
{
"triggerKey": "number", #次数(循环类型) 全局
"value": 2
},
{
"triggerKey": "business_num", # 评论新闻篇数 (循环类型) 全局
"value": 2
}
]
}
result = self.post(self.url, json.dumps(data), headers=self.header_json)
code = result.json()['code']
print(result.json())
self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN') # 积分策略没有启用
self.assertEquals(code,'SUCCESS')
# 新闻资讯-点赞
def test_like(self):
print(self.triggerKeyDict)
data = {
"memUid": self.jipeihong_uid,
"businessKey": self.businessKey,
"businessAct": "like",
"remark": "新闻资讯-点赞",
"businessId": "55",
"triggerTypes": [
{
"triggerKey": "number", #次数(循环类型) 全局
"value": 2
}
]
}
result = self.post(self.url, json.dumps(data), headers=self.header_json)
code = result.json()['code']
print(result.json())
self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN') # 积分策略没有启用
self.assertEquals(code,'SUCCESS')
# 新闻资讯-阅读
def test_read(self):
print(self.triggerKeyDict)
data = {
"memUid": self.jipeihong_uid,
"businessKey": self.businessKey,
"businessAct": "read",
"remark": "新闻资讯-阅读",
"businessId": "55",
"triggerTypes": [
{
"triggerKey": "complete", #完成 (枚举类型) 单个
"value": 2
},
{
"triggerKey": "complete_num", # 完成阅读新闻篇数(循环类型) 全局
"value": 2
}
]
}
result = self.post(self.url, json.dumps(data), headers=self.header_json)
code = result.json()['code']
print(result.json())
self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN') # 积分策略没有启用
self.assertEquals(code,'SUCCESS')
# 新闻资讯-收藏
def test_collect(self):
print(self.triggerKeyDict)
data = {
"memUid": self.jipeihong_uid,
"businessKey": self.businessKey,
"businessAct": "collect",
"remark": "新闻资讯-收藏",
"businessId": "55",
"triggerTypes": [
{
"triggerKey": "collect_num", #次数(循环类型) 全局
"value": 2
}
]
}
result = self.post(self.url, json.dumps(data), headers=self.header_json)
code = result.json()['code']
print(result.json())
self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN') # 积分策略没有启用
self.assertEquals(code,'SUCCESS')