test_active_center.py 4.4 KB
import json

from atdd.ATDDCase import ATDDCase
from tests.Integral.publicMethods import PCpublicMethods


class ActiveCenter(ATDDCase):

    global list
    url = ATDDCase().uc_host + '/a/' + ATDDCase().domain + '/' + ATDDCase().app + "/qy/integral/change"
    businessKey = "active_center"
    triggerKeyDict = PCpublicMethods.PCpublicMethods().getTriggerKey(businessKey)
    triggerValueDict = PCpublicMethods.PCpublicMethods().getTriggerValue(businessKey)

    def setUp(self):
        pass

    # 活动中心-回帖被回复
    def test_was_reply(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "was_reply",
            "remark": "活动中心-回帖被回复",
            "businessId": "555",
            "triggerTypes": [
                {
                    "triggerKey": "number",  # 次数(循环类型)全局
                    "value": 5
                },
                {
                    "triggerKey": "was_reply_num",  # 被回复个数(循环类型)全局
                    "value": 5
                }
            ]
        }

        result = self.post(self.url, json.dumps(data), headers=self.header_json)
        code = result.json()['code']
        self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN')  # 积分策略没有启用
        self.assertEquals(code, 'SUCCESS')
        self.assertEquals(result.json()['data'][0]['message'], '')
        print(result.json())

    # 活动中心-回帖
    def test_reply(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "reply",
            "remark": "活动中心-回帖被回复",
            "businessId": "555",
            "triggerTypes": [
                {
                    "triggerKey": "number",  #次数(循环类型)全局
                    "value": 1
                },
                {
                    "triggerKey": "reply_business_num",  # 回复活动数(循环类型)全局
                    "value": 1
                }
            ]
        }
        result = self.post(self.url, json.dumps(data), headers=self.header_json)
        code = result.json()['code']
        self.assertNotEquals(code, 'INTEGRAL_RULE_NDAYOT_OPEN')  # 积分策略没有启用
        self.assertEquals(code, 'SUCCESS')
        self.assertEquals(result.json()['data'][0]['message'], '')
        print(result.json())

    # 活动中心-回帖
    def test_answered(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "reply",
            "remark": "活动中心-回帖被回复",
            "businessId": "555",
            "triggerTypes": [
                {
                    "triggerKey": "number",  # 次数(循环类型)全局
                    "value": 1
                },
                {
                    "triggerKey": "reply_business_num",  # 回复回帖个数(循环类型)全局
                    "value": 1
                }
            ]
        }

        result = self.post(self.url, json.dumps(data), headers=self.header_json)
        code = result.json()['code']
        self.assertNotEquals(code,'INTEGRAL_RULE_NDAYOT_OPEN')  #积分策略没有启用
        self.assertEquals(code, 'SUCCESS')
        self.assertEquals(result.json()['data'][0]['message'], '')
        print(result.json())

    # 活动中心-回帖楼层
    def test_reply_floor(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "reply_floor",
            "remark": "活动中心-回帖楼层",
            "businessId": "555",
            "triggerTypes": [
                {
                    "triggerKey": "number",  #楼层(循环类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "reply_floor_range",  # 楼层区间(自定义枚举类型)单个
                    "value": 1
                }
            ]
        }

        result = self.post(self.url, json.dumps(data), headers=self.header_json)
        code = result.json()['code']
        self.assertNotEquals(code,'INTEGRAL_RULE_NDAYOT_OPEN')  #积分策略没有启用
        self.assertEquals(code, 'SUCCESS')
        self.assertEquals(result.json()['data'][0]['message'], '')
        print(result.json())