def test_GetPubcat(self, cid, token): value = {'cid': cid, 'token': token} #data = SendHttpRequest(self.url).get(value) data = SendHttpRequest(self.url).post_json(value) json_data = jsonprase(data) print(json_data) '''
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_GetSchDetl(self): value = dict(cid='402881ed5431bc0e015431bcb5ce0001', token='weixin123', uid='2494AE0905EA483F8CDC6C3F94F4927E', schid='402881ec55013b260155013b74b90e73') data = SendHttpRequest(self.url).post_json(value) json_data = jsonprase(data) pyapixml(json_data.json_to_xml) #print(data) print(json_data.json_to_xml)
def test_GetPubcat(self): #value = {'cid': cid, 'token': token} value = dict(cid='402881ed5431bc0e015431bcb5ce0001', token='weixin123') #data = SendHttpRequest(self.url).get(value) data = SendHttpRequest(self.url).post_json(value) json_data = jsonprase(data) ''' with open('test_GetpUBCAT.xml','w',encoding='utf-8') as f: f.write(json_data.json_to_xml) ''' pyapixml(json_data.json_to_xml) print(json_data.json_to_xml)
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 != ""
def test_Single_error(self, sid, count): value = {"sid": sid, "count": count} data = SendHttpRequest(self.url).get(value) self.assertEqual(data, u'{"Message":"请求无效。"}')