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 result 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 result self.checkResult()
def testRegisterQuick(self): """ test body :return: """ # set url self.url = common_1.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 logout(token): """ logout :param token: login token :return: """ # set url url = common_1.get_url_from_xml('logout') localConfigHttp.set_url(url) # set header header = {'token': token} localConfigHttp.set_headers(header) # logout localConfigHttp.get()
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 result self.checkResult()
def login(): """ login :return: token """ # set url url = common_1.get_url_from_xml('login') localConfigHttp.set_url(url) # set header token = localReadConfig.get_headers("token_v") header = {"token": token} localConfigHttp.set_headers(header) # set param data = {"email": localLogin_xls[0][3], "password": localLogin_xls[0][4]} localConfigHttp.set_data(data) # login response = localConfigHttp.post().json() token = common_1.get_value_from_return_json(response, "member", "token") return token
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 result self.checkResult()