def get_session(cls, base_path): content = uiti.get_json(base_path) URL = '%s://%s:%s/%s' % (content['PROTOCOL'], content['HOST'], content['PORT'], content['AURL']) data = { 'userName': content['username'], 'userPass': content['password'], 'checkcode': content['checkcode'] } session = requests.session() resp = session.post(URL, data) return session
def get_session(cls, base_path): content = uiti.get_json(base_path) URL = '%s://%s:%s/%s/login/userLogin' % ( content['PROTOCOL'], content['HOST'], content['PORT'], content['AURL']) data = { 'userName': content['username'], 'userPass': content['password'], 'checkcode': content['checkcode'], 'remember': 'Y' } session = requests.session() resp = session.post(URL, data) #cookies = resp.cookies return session
import unittest from parameterized import parameterized from woniubossAPIDDT.lib.training import Training from woniubossAPIDDT.tools.service import Service from woniubossAPIDDT.tools.uiti import uiti test_info = uiti.get_json('..\\conf\\testdata.conf') train_infos = uiti.trans_dict_tup(test_info[1]) follow_infos = uiti.trans_dict_tup(test_info[2]) query_infos = uiti.trans_dict_tup(test_info[3]) edit_infos = uiti.trans_dict_tup(test_info[4]) abandon_infos = uiti.trans_dict_tup(test_info[5]) transQuery_infos = uiti.trans_dict_tup(test_info[6]) see_infos = uiti.trans_dict_tup(test_info[7]) commit_infos = uiti.trans_dict_tup(test_info[8]) allQuery_infos = uiti.trans_dict_tup(test_info[9]) submit_infos = uiti.trans_dict_tup(test_info[10]) allot_infos = uiti.trans_dict_tup(test_info[11]) pubQuery_infos = uiti.trans_dict_tup(test_info[12]) owner_infos = uiti.trans_dict_tup(test_info[13]) class trainingTest(unittest.TestCase): def setUp(self): print("begin test") def tearDown(self): print("test over")