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.
 
 

36 lines
1.3 KiB

#-*-coding:utf-8-*-
__author__ = 'Emily'
# 5.自助机取票码取票接口
#http://IP/?m=Autoapi&a=getSaleBySmscode
#服务端log:cd /data0/cine/var/logs/ticketCollectMachine
import unittest
import requests
class getSaleBySmscode(unittest.TestCase):
def setUp(self):
self.post_url = 'http://192.168.55.99/?m=Autoapi&a=getSaleBySmscode&smscode=66644000129770'
self.header = {'Content-Type':'application/x-www-form-urlencoded','CINEMACODE':'849'}
def test_getSaleBySmscode(self):
"""传入smscode取票码"""
payload='&data={"smscode":66644000023940}'
rep = requests.post(self.post_url, headers=self.header, data=payload)
result = rep.json()
print('打印影片信息', result)
self.assertEqual(result['status'], 2102, msg='请求成功')
def test_nullgetSaleBySmscode(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()