def testGetAddressList(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('deleteAddress') configHttp.set_url(self.url) # get visitor token token = localReadConfig.get_headers("TOKEN_U") # set headers header = {"token": str(token)} configHttp.set_headers(header) # set params params = {"address_id": self.address_id} configHttp.set_params(params) # test interface self.return_json = configHttp.get() # check result self.checkResult()
def testGetAddressList(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('getAddress') configHttp.set_url(self.url) # get token if self.token == '0': token = self.login_token else: token = self.token # set headers header = {"token": str(token)} configHttp.set_headers(header) # set params params = {"address_id": self.address_id} configHttp.set_params(params) # test interface self.return_json = configHttp.get() # check result self.checkResult()
def testUpdatePassword(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('updatePassword') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = self.login_token elif self.token == '1': token = localReadConfig.get_headers("token_v") else: token = self.token header = {'token': token} localConfigHttp.set_headers(header) # set param data = { 'old_password': self.oldPwd, 'password': self.pwd, 'password_confirm': self.pwdConfirm } localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.post() # check result self.checkResult()
def testRegisterQuick(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('registerQuick') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = localReadConfig.get_headers("token_v") elif self.token == '1': token = None header = {'token': token} localConfigHttp.set_headers(header) # set params data = {'email': self.email} localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.post() # check result self.checkResult()
def testqueryFxddFptj(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('queryFxddFptj') localConfigHttp.set_url(self.url) # set header if self.cookie == '0': cookie = localReadConfig.get_headers("fxdd_cookies") header = { "Content-Type": "application/json;charset=UTF-8", "Cookie": cookie } elif self.cookie == '1': # cookie = None header = {"Content-Type": "application/json;charset=UTF-8"} localConfigHttp.set_headers(header) # set params # data = {'jsonStr': self.data} # localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.get() # check result self.checkResult()
def testLogin(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('login') configHttp.set_url(self.url) print("第一步:设置url "+self.url) # get visitor token if self.token == '0': token = localReadConfig.get_headers("token_v") elif self.token == '1': token = None # set headers header = {"token": str(token)} configHttp.set_headers(header) print("第二步:设置header(token等)") # set params data = {"email": self.email, "password": self.password} configHttp.set_data(data) print("第三步:设置发送请求的参数") # test interface self.return_json = configHttp.post() method = str(self.return_json.request)[int(str(self.return_json.request).find('['))+1:int(str(self.return_json.request).find(']'))] print("第四步:发送请求\n\t\t请求方法:"+method) # check result self.checkResult() print("第五步:检查结果")
def testAccountSetting(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('accountSetting') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = self.login_token else: token = self.token header = {'token': token} localConfigHttp.set_headers(header) # set param data = { 'sex': self.sex, 'telephone': self.telephone, 'nickname': self.nickname, 'birthday': self.birthday, 'country_id': self.countryId } localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.post() # check result self.checkResult()
def testGetProductInfo(self): """ test body :return: """ # set uel self.url = common.get_url_from_xml('productInfo') localConfigHttp.set_url(self.url) # set params if self.goodsId == '' or self.goodsId is None: params = None elif self.goodsId == 'null': params = {"goods_id": ""} else: params = {"goods_id": self.goodsId} localConfigHttp.set_params(params) # set headers if self.token == '0': token = localReadConfig.get_headers("token_v") else: token = self.token headers = {"token": str(token)} localConfigHttp.set_headers(headers) # get http self.response = localConfigHttp.get() # check result self.checkResult()
def testgetgzsjlist(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('getgzsjlist') localConfigHttp.set_url(self.url) # set header if self.cookie == '0': cookie = localReadConfig.get_headers("gzfx_cookies") elif self.cookie == '1': cookie = None header = { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Cookie": cookie } localConfigHttp.set_headers(header) # set params data = {'jsonStr': self.data} localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.post() # check result self.checkResult()
def testUploadImg(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('uploadImg') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = self.login_token elif self.token == '1': token = localReadConfig.get_headers("token_v") else: token = self.token header = {'token': token} localConfigHttp.set_headers(header) # set files localConfigHttp.set_files(self.file) # set data data = {'whole': self.whole} localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.postWithFile() # check result self.checkResult()
def testGenerate(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('generate') localConfigHttp.set_url(self.url) # test interface self.response = localConfigHttp.get() # check result self.checkResult()
def testAddAddress(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('addAddress') configHttp.set_url(self.url) # get token if self.token == '0': token = self.login_token elif self.token == '1': token = localReadConfig.get_headers("TOKEN_U") else: token = self.token # set headers header = {"token": str(token)} configHttp.set_headers(header) # set params data = { "sex": self.sex, "fname": self.fname, "lname": self.lname, "tel": self.tel, "standby_tel": self.standby_tel, "address1": self.address1, "address2": self.address2, "city": self.city, "state": self.state, "postcode": self.postcode, "country_id": self.country_id, "tax_number": self.tax_number, "company": self.company, "fax": self.fax, "is_default": self.is_default } configHttp.set_data(data) # test interface self.return_json = configHttp.post() # check result self.checkResult()
def setUp(self): """ :return: """ self.token = common.get_pda_token() self.log = MyLog.get_log() self.logger = self.log.get_logger() url = common.get_url_from_xml('parking') # set token to config # set params params = f"appId={localReadConfig.get_pda_date('appId')}&" \ f"berthcode={self.berthcode}&" \ f"carplatecolour=1&" \ f"carproperty={self.carproperty}&" \ f"comid={localReadConfig.get_pda_date('comid')}&" \ f"dotime={self.startime}&" \ f"issensor=1&" \ f"method=startParking&" \ f"module=pda&" \ f"payType=1&" \ f"pdaareatype=1&" \ f"platenumber={self.carnumber}&" \ f"sectionid={localReadConfig.get_pda_date('sectionid')}&" \ f"service=Std&" \ f"terminalno={localReadConfig.get_pda_date('terminalno')}&" \ f"u={self.token['u']}&" \ f"v={self.token['v']}&" \ f"ve=2&" \ f"vehicletype={self.vehicletype}" self.url = url + '?' + get_md5date.get_kq_app(params) localConfigHttp.set_url(self.url) # test interface self.response = localConfigHttp.get() # check result self.checkResult_Start() self.log.build_case_line(self.case_name, str(self.info_Start['_outTime']), self.info_Start['message']) self.orderid = self.response.json()['orderid']
def testLoginFB(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('loginFb') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = localReadConfig.get_headers("token_v") elif self.token == '1': token = None header = {'token': token} localConfigHttp.set_headers(header) # set params if self.invite_agency == '': self.invite_agency = int(0) data = { 'email': self.email, 'facebook_id': self.facebook_id, 'fbtoken': self.fbtoken, 'invite_agency': self.invite_agency } localConfigHttp.set_data(data) # test interface if self.method == 'get': self.response = localConfigHttp.get() elif self.method == 'post': self.response = localConfigHttp.post() else: self.logger.info("No this interface's method:" + self.method) # check result self.checkResult()
def testLogout(self): """ test body :return: """ # set url self.url = common.get_url_from_xml('logout') localConfigHttp.set_url(self.url) # set header if self.token == '0': token = self.login_token elif self.token == '1': token = localReadConfig.get_headers("token_v") else: token = self.token header = {'token': token} localConfigHttp.set_headers(header) # test interface self.response = localConfigHttp.get() # check result self.checkResult()
def test_parking_Billing(self): """ test body :return: """ # set url url = common.get_url_from_xml('parking') # set token to config # set params params = f"appId={localReadConfig.get_pda_date('appId')}&" \ f"comid={localReadConfig.get_pda_date('comid')}&" \ f"endparktime={self.endtime}&" \ f"isescape=0&" \ f"method=overParking&" \ f"module=pda&" \ f"orderid={self.orderid}&" \ f"outareaid={localReadConfig.get_pda_date('areaid')}&" \ f"outcantonid={localReadConfig.get_pda_date('cantonid')}&" \ f"outsectionid={localReadConfig.get_pda_date('sectionid')}&" \ f"payType=1&" \ f"pdaareatype=1&" \ f"service=Std&" \ f"terminalno={localReadConfig.get_pda_date('terminalno')}&" \ f"u={self.token['u']}&" \ f"v={self.token['v']}&" \ f"ve=2" self.url = url + '?' + get_md5date.get_kq_app(params) localConfigHttp.set_url(self.url) # test interface self.response = localConfigHttp.get() # check result self.checkResult_End()