def test_requests_online_xml(self, tourId): xml_url = self.url + "/%s" % tourId data = SendHttpRequest(xml_url).get() json_st = xmlprase(data).xml_to_json json_data = jsonprase(json_st) lng = json_data.find_json_node_by_xpath("/root/data/@lng") lat = json_data.find_json_node_by_xpath("/root/data/@lat") assert lng != "" and lat != "" son_tour = json_data.find_json_node_by_xpath("/root/data/data") assert len(son_tour) > 0
def test_Single_right(self, sid, count): value = {"sid": sid, "count": count} data = SendHttpRequest(self.url).get(value) json_data = jsonprase(data) point_lat = json_data.find_json_node_by_xpath("/Point/Lat") point_lng = json_data.find_json_node_by_xpath("/Point/Lng") is_exists_map = json_data.find_json_node_by_xpath("/Ptd/AmapGuideMap155/IsExistsMap") size = json_data.find_json_node_by_xpath("/Ptd/AmapGuideMap155/Size") # 坐标断言 assert float(point_lat) != 0 and float(point_lng) != 0 # 下载地址断言 assert json_data.find_json_node_by_xpath("/Ptd/AmapGuideMap155/DownUrl") is not None if is_exists_map == True: assert size != ""