test_add_role.py 751 Bytes
import unittest
from atdd.PcPost import PcPost
import random


class Addrole(PcPost):
    name = random.randint(1, 10000)
    url = '/Contact/Apicp/Role/Add'

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

    # 正常添加岗位信息
    def test_addrole(self):
        data = {
            'roleName': 'AddroleApi' + str(self.name)
        }
        result = self.PcPost(self.url, data)
        print('接口地址:' + self.host + self.domain + self.url)
        self.assertEqual('ok', result['errmsg'], msg=result['errmsg'])
        roldId = result['result']['roleId']
        # print('成功生成岗位!岗位ID:' + roleId)
        return result

if __name__ == '__main__':
    unittest.main()