def testGetAddressList(self): """ test body :return: """ # set url self.url = common_1.get_url_from_xml('getAddressList') configHttp.set_url(self.url) print(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) # test interface self.return_json = configHttp.get() # check jkresult self.checkResult()
def testRegister(self): """ test body :return: """ # set url self.url = common_1.get_url_from_xml('register') 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, 'password': self.password, 'password_confirm': self.confirmpwd} localConfigHttp.set_data(data) # test interface self.response = localConfigHttp.post() # check jkresult self.checkResult()
def testUploadImg(self): """ test body :return: """ # set url self.url = common_1.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 jkresult self.checkResult()
def testUpdatePassword(self): """ test body :return: """ # set url self.url = common_1.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 jkresult self.checkResult()
def testLoginFB(self): """ test body :return: """ # set url self.url = common_1.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 jkresult self.checkResult()
def testLogout(self): """ test body :return: """ # set url self.url = common_1.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 jkresult self.checkResult()