You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.5 KiB
44 lines
1.5 KiB
#-*-coding:utf-8-*- |
|
__author__ = 'Emily' |
|
# 6.自助机取票查询活动信息接口 |
|
#http://IP/?m=Autoapi&a=getActivityInfo |
|
import unittest |
|
import requests |
|
|
|
class getActivityInfo(unittest.TestCase): |
|
def setUp(self): |
|
self.post_url = 'http://192.168.55.99/?m=Autoapi&a=getActivityInfo' |
|
self.header = {'Content-Type':'application/x-www-form-urlencoded','CINEMACODE':'304'} |
|
|
|
def test_getSaleBySmscode(self): |
|
"""传入smscode取票码""" |
|
payload='¶m={"smscode":"66644000279780"}' |
|
rep = requests.post(self.post_url, headers=self.header, data=payload) |
|
result = rep.json() |
|
print('打印活动信息', result) |
|
self.assertEqual(result['status'], 0, msg='请求成功') |
|
|
|
def test_getSaleBySmscodeNull(self): |
|
"""不传入smscode取票码""" |
|
payload='' |
|
rep = requests.post(self.post_url, headers=self.header, data=payload) |
|
result = rep.json() |
|
print('打印影片信息', result) |
|
#self.assertEqual(rep.status_code, 1000, msg='返回值不为100,接口不通') |
|
self.assertEqual(result['status'], 1000, msg='请求成功') |
|
|
|
def tearDown(self): |
|
pass |
|
|
|
if __name__ == '__main__': |
|
unittest.main() |
|
#构造测试集 |
|
# suite = unittest.TestSuite() |
|
# suite.addTest(getActivityInfo("test_getSaleBySmscode")) |
|
# suite.addTest(getActivityInfo("test_getSaleBySmscodeNull")) |
|
# # 执行测试 |
|
# runner = unittest.TextTestRunner() |
|
# runner.run(suite) |
|
|
|
|
|
|
|
|