test_exam_center.py 3.04 KB
import json

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


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

    def setUp(self):
        pass

    # 考试中心-测评考试
    def test_official_exam(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "official_exam",
            "remark": "考试中心-测评考试",
            "businessId": "5",
            "triggerTypes": [
                {
                    "triggerKey": "pass",  # 通过(枚举类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "exam_score",  # 考试分数(阈值类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "exam_score_range",  # 考试分数区间(区间类型)单个
                    "value": self.triggerValueDict['official_exam-exam_score_range'][0]['condition'][1]
                },
                {
                    "triggerKey": "pass_num",  # 通过试卷数(循环类型)全局
                    "value": 1
                }
            ]
        }

        print(data)
        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')
        print(result.json())



    # 考试中心-模拟考试
    def test_mock_exam(self):
        data = {
            "memUid": self.jipeihong_uid,
            "businessKey": self.businessKey,
            "businessAct": "mock_exam",
            "remark": "考试中心-模拟考试",
            "businessId": "5",
            "triggerTypes": [
                {
                    "triggerKey": "pass",  # 通过(枚举类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "exam_score",  # 考试分数(阈值类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "exam_score_range",  # 考试分数区间(区间类型)单个
                    "value": 1
                },
                {
                    "triggerKey": "pass_num",  # 通过试卷数(循环类型)全局
                    "value": 1
                }
            ]
        }

        print(data)
        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')
        print(result.json())