test_AuthorityAdd.py 1.75 KB


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

class AuthorityAdd(PcPost):

    global list
    interfaceUrl = "/Assistant/Apicp/Integral/AuthorityAdd"
    rank_filter = 0
    ROLE = 1
    JOB = 2

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

    '''
        @parameters:
        visibleRange	    是	Array	可查看岗位/角色范围
        visibleRangeType	是	Int	    1: 角色 2: 岗位
    '''

    # 员工积分排名 权限范围添加,参数为空
    def test_AuthorityAdd_None(self):
        data = {}
        # 参数(可查看权限范围)不能为空
        errcode = 1120000
        result = self.PcPostAbnormal(self.interfaceUrl, data, errcode)
        print(result)
        return result

    # 员工积分排名 权限范围添加: 角色
    def test_AuthorityAdd_Role(self):

        # 先判断排名筛选条件是否为角色
        #self.assertEquals(self.ROLE, self.rank_filter)

        roleID = PCpublicMethods.PCpublicMethods().getRoleID("季培红角色")

        data = {
            "visibleRange": roleID,
            "visibleRangeType": self.ROLE   # 角色
        }
        result = self.PcPost(self.interfaceUrl, data)
        print(result)
        return result

    # 员工积分排名 权限范围添加: 岗位
    def test_AuthorityList_Job(self):

        # 先判断排名筛选条件是否为岗位
        self.assertEquals(self.JOB, self.rank_filter)
        jobID = PCpublicMethods.PCpublicMethods().getJobID("季培红岗位")

        data = {
            "visibleRange": jobID,
            "visibleRangeType": self.JOB   # 岗位
        }
        result = self.PcPost(self.interfaceUrl, data)
        print(result)
        return result