test_jobSetting.py 1.11 KB

from atdd.PcPost import PcPost

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

    # 岗位list——岗位管理页面
    def test_getJobList(self):
        interfaceUrl = "/Contact/Apicp/Job/List"
        data = {
            "page": 1,
            "limit": 10
        }
        result = self.PcPost(interfaceUrl,data)
        return result

    # 获取所有岗位的ID,以list格式返回
    def get_all_jobId(self):
        jobList = self.test_getJobList()['result']['list']
        jobIdList = []
        for i in range(len(jobList)):
            jobId = jobList[i]['jobId'].split()
            # 将jobId加入到jobIdList中
            jobIdList[len(jobIdList):len(jobIdList)] = jobId
        return jobIdList

    # 根据岗位名称获取岗位ID
    def getJobID(self, jobName):
        jobList = self.test_getJobList()['result']['list']
        for i in range(len(jobList)):
            if (jobList[i]['jobName'] == jobName):
                jobId = jobList[i]['jobId']
            else:
                jobId = None
            return jobId