def testrequest_xml(self): """Get XML from epsg.io""" u = 'http://epsg.io/4326.xml' d = ap.request(u, None, 'xml') tg = str(d.tag) tp = '{http://www.opengis.net/gml/3.2}GeographicCRS' self.assertEqual(tg, tp)
def testrequest_json(self): """Get json from arcgis sampleserver""" u = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services' d = ap.request(u, {'f':'json'}, 'json') items = [ isinstance(d, dict), isinstance(d.get('services'), list), isinstance(d.get('folders'), list), isinstance(d.get('currentVersion'), int) ] self.assertTrue(all(items))
def testrequest_text(self): """Basic test to get a page as text""" d = ap.request('http://google.com') self.assertNotEqual(d, '')