def checkResult(self): self.info = self.response.json() common.show_return_msg(self.response) if self.result == '0': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) goods_id = common.get_value_from_return_json( self.info, "Product", "goods_id") self.assertEqual(goods_id, self.goodsId) if self.result == '1': self.assertEqual(self.info['code'], self.info['code']) self.assertEqual(self.info['msg'], self.msg)
def checkResult(self): """ check test result :return: """ self.info = self.return_json.json() common.show_return_msg(self.return_json) if self.result == '0': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'sex'), self.sex) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'fname'), self.fname) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'lname'), self.lname) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'tel'), self.tel) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'address1'), self.address1) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'city'), self.city) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'state'), self.state) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'postcode'), self.postcode) self.assertEqual( common.get_value_from_return_json(self.info, 'address', 'countryId'), self.country_id) if self.result == '1': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg)
def tearDown(self): """ :return: """ info = self.info if info['code'] == 0: # get uer token token_u = common.get_value_from_return_json( info, 'member', 'token') # set user token to config file localReadConfig.set_headers("TOKEN_U", token_u) else: pass self.log.build_case_line(self.case_name, self.info['code'], self.info['msg']) print("测试结束,输出log完结\n\n")
def checkResult(self): """ check test result :return: """ self.info = self.return_json.json() # show return message common.show_return_msg(self.return_json) if self.result == '0': email = common.get_value_from_return_json(self.info, 'member', 'email') self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) self.assertEqual(email, self.email) if self.result == '1': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg)
def checkResult(self): """ :return: """ self.info = self.return_json.json() common.show_return_msg(self.return_json) if self.result == '0': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) self.assertIsNotNone(self.info['info']['address']) value = common.get_value_from_return_json(self.info, "address", "addressId") self.assertEqual(value, self.address_id) if self.result == '1': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg)
def checkResult(self): """ :return: """ self.info = self.response.json() common.show_return_msg(self.response) if self.result == '0': email = common.get_value_from_return_json(self.info, 'member', 'email') self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) self.assertEqual(email, self.email) if self.result == '1': self.assertEqual(self.info['code'], self.code) self.assertEqual(self.info['msg'], self.msg) if self.case_name == 'registerQuick_EmailExist': sql = common.get_sql('newsitetest', 'rs_member', 'delete_user') localConfigDB.executeSQL(sql, self.email) localConfigDB.closeDB()
def login(): """ login :return: token """ # set url url = common.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.get_value_from_return_json(response, "member", "token") return token