test_add_job.py
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import unittest
from atdd.PcPost import PcPost
import random
class AddJob(PcPost):
name = random.randint(1, 10000)
url = '/Contact/Apicp/Job/Add'
def setUp(self):
self.do_login(self.host, self.mobile, self.psw, self.domain)
# 正常添加岗位信息
def test_addjob(self):
data = {
'jobName': 'AddJobApi' + str(self.name) # 如何动态读取
}
result = self.PcPost(self.url, data)
print('接口地址:' + self.host + self.domain + self.url)
jobId = result['result']['jobId']
print('成功生成岗位!岗位ID:' + jobId)
# self.assertEqual(jobId, , msg='成功生成测试jobId') # 如何判断生成的Jobid
return result
# 岗位名称超过20个汉字
def test_addjob_namelen(self):
url = '/Contact/Apicp/Job/Add'
data = {
'jobName': '新增岗位接口,测试岗位名称超过20个汉字' + str(self.name)
}
result = self.PcPost(self.url, data)
jobId = result['result']['jobId']
print('成功生成岗位!岗位ID:' + jobId)
return result
if __name__ == '__main__':
unittest.main()