test_add_Attribute.py 887 Bytes
import unittest
from atdd.PcPost import PcPost
import random


class AddAttribute(PcPost):
    name = random.randint(1, 10000)
    url = '/contact/Apicp/Attribute/Save'

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

    # 字段类型-单行文本(type1)
    def test_Attribute1(self):
        data = {
            'attr_name': 'AddAttribute' + str(self.name),
            'type': 1,
            'is_open_cp': 1,
            'is_open': 1,
            'is_required_cp': 1,
        }
        result = self.PcPost(self.url, data)
        print('接口地址:' + self.host + self.domain + self.url)
        jobId = result['result']['jobId']
        self.assertEqual('ok', result['errmsg'], msg=result['errmsg'])
        print('成功生成岗位!岗位ID:' + jobId)
        return result

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