test_defaultLevel.py 1.9 KB
'''
Author: jipeigong 2017年7月19日17:53:38
'''

from atdd.PcApiTest import PcApiTest
from tests.Integral.IntergalPC.test_Integral import Integral


class DefaultLevel(PcApiTest):

    def setUp(self):
        self.do_login(self.host, self.mobile, self.psw, self.domain)

    # 默认等级查询接口
    def test_levelSearch(self):
        interfaceUrl = "/Integral/Apicp/Level/GetSetting"
        result = self.PcApiTest(interfaceUrl)
        print(result)
        return result


    # 获取企业计算等级规则明细——默认等级
    def test_levelList_default(self):
        interfaceUrl = "/Integral/Apicp/Level/List"
        data = {
            "page": 1,
            "limit": 10,
            "eilType": "0",  # 默认
            "pageNum": 1,
            "pageSize": 999
        }
        result = self.PcApiTest(interfaceUrl,data)
        print(result)
        return result


    # 编辑默认积分等级接口
    def test_levelEdit_default(self):
        interfaceUrl = "/Integral/Apicp/Level/UpdateDefaultLevel"

        # 获取icon的ID和URL
        uploadAtta = Integral().test_UploadAtta()
        icon = uploadAtta['result']['atId']
        iconUrl = uploadAtta['result']['atAttachment']

        # 获取等级ID
        levelList = self.test_levelList_default()
        eilId = (levelList['result']['list'][0])['eilId']

        data = self.parse_array("eilLevelSetting", [
            {
                "name": "LV1",
                "max": 100,
                "icon": icon,
                "iconUrl": iconUrl,
                "iconType": "2"
            },
            {
                "name": "LV10",
                "max": -1,
                "icon": icon,
                "iconUrl": iconUrl,
                "iconType": "2"
            }])

        # 等级ID
        data["eilId"] = eilId

        result = self.PcApiTest(interfaceUrl,data)
        print(result)
        return result