Пример #1
0
class EventDetail(unittest.TestCase):
    '''获取会议详细信息接口'''
    url = 'http://139.199.132.220:9000/event/api/get_eventdetail/'
    headers = {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Cookie': 'token=75ff30521dd7bafb48e07cf7e0a0b564dd8896a4;uid=1'
    }
    data = {'id': '5723'}
    sign = util.create_sign('75ff30521dd7bafb48e07cf7e0a0b564dd8896a4', data)
    data['sign'] = sign

    def test_get_eventdetail01(self):
        '''会议详细信息接口-正向流程'''
        # url = 'http://139.199.132.220:9000/event/api/get_eventdetail/'
        # headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': 'token=75ff30521dd7bafb48e07cf7e0a0b564dd8896a4;uid=1'}
        # data = {
        #     'id': '5723'
        # }
        # sign = util.create_sign('75ff30521dd7bafb48e07cf7e0a0b564dd8896a4', data)
        # data['sign'] = sign
        res = requests.get(url=self.url,
                           headers=self.headers,
                           params=self.data)

        self.assertEqual(res.status_code, 200)
        self.assertEqual(res.json().get('error_code'), 0)
        self.assertEqual(res.json().get('event_detail').get('id'), '5723')
        self.assertLess(int(round(res.elapsed.total_seconds() * 1000)), 500)
Пример #2
0
    def test_case4(self):

        # print 4
        url = 'http://139.199.132.220:9000/event/api/get_eventdetail/'
        headers = {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Cookie': 'token=75ff30521dd7bafb48e07cf7e0a0b564dd8896a4;uid=1'
        }

        data = {'id': '5713'}

        sign = util.create_sign('75ff30521dd7bafb48e07cf7e0a0b564dd8896a4',
                                data)
        data['sign'] = sign

        res = requests.get(url=url, headers=headers, params=data)

        print res.status_code
        print res.text
Пример #3
0
	def test_case03(self):

		url = 'http://139.199.132.220:9000/event/api/add_event/'
		headers = {
			'Content-Type': 'application/x-www-form-urlencoded', 
			'Cookie': 'token=75ff30521dd7bafb48e07cf7e0a0b564dd8896a4;uid=1'
			}

		data = {
		    'title': '慧测接口测试02',
		    'time': '2018-09-01 15:00:00',
		    'address': '汤立路220号1号楼007',
		}

		sign = util.create_sign('75ff30521dd7bafb48e07cf7e0a0b564dd8896a4', data)
		data['sign'] = sign


		res = requests.post(url=url, headers=headers, data=data)

		print res.status_code
		print res.text
Пример #4
0
#coding:utf-8
import requests
import base64
import json
import util

# headers = {'Content-Type': 'application/x-www-form-urlencoded'}
# data = {'username':'******', 'password': base64.encodestring('123huicehuice!@#')}
# res = requests.post(url='http://139.199.132.220:9000/event/api/register/',
#               headers=headers,
#               data=data)
# print res.status_code
# print json.loads(res.text).get('token')

url = 'http://139.199.132.220:9000/event/api/add_event/'
headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Cookie': 'token=75ff30521dd7bafb48e07cf7e0a0b564dd8896a4;uid=1'}
data = {
    'title': '慧测接口测试',
    'time': '2018-09-01 15:00:00',
    'address': '汤立路220号1号楼007',
}
sign = util.create_sign('75ff30521dd7bafb48e07cf7e0a0b564dd8896a4', data)
data['sign'] = sign
res = requests.post(url=url,
              headers=headers,
              data=data)
print res.status_code
print res.text