test_invite_colleague.py 2.86 KB
import json

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


class InviteColleague(ATDDCase):

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

    def setUp(self):
        pass

    # 邀请同事-邀请人数
    def test_invite_number(self):
        print(self.triggerKeyDict)
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "invite_number",
            "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_review_pass(self):
        print(self.triggerKeyDict)
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "review_pass",
            "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_review_reject(self):
        print(self.triggerKeyDict)
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "review_reject",
            "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')