def test_list_collection(self, wlts_objects, requests_mock): for k in wlts_objects: s = wlts.WLTS(url) requests_mock.get(match_url, json=wlts_objects[k]['list_collections.json'], status_code=200, headers={'content-type': 'application/json'}) response = s.collections assert type(response) == list assert response == ["prodes_amz", "prodes_cerrado", "deter_amz", "deter_cerrado", "mapbiomas_4_1_amz"]
def test_trajectory(self, wlts_objects, requests_mock): for k in wlts_objects: s = wlts.WLTS(url) requests_mock.get(match_url, json=wlts_objects[k]['trajectory.json'], status_code=200, headers={'content-type': 'application/json'}) trajectory = s.tj(latitude=-12.31, longitude=-53.63) assert 'query' in trajectory assert 'result' in trajectory assert trajectory['query']['latitude'] assert trajectory['query']['longitude'] assert 'trajectory' in trajectory['result']
def test_describe_collection(self, wlts_objects, requests_mock): for k in wlts_objects: s = wlts.WLTS(url) requests_mock.get(match_url, json=wlts_objects[k]['describe_collection.json'], status_code=200, headers={'content-type': 'application/json'}) collection = s['prodes_cerrado'] assert collection == wlts_objects[k]['describe_collection.json'] assert collection['collection_type'] assert collection['description'] assert collection['detail'] assert collection['name'] assert collection['period'] assert collection['resolution_unit'] assert collection['spatial_extent']
def test_wlts(self): service = wlts.WLTS(url) assert service.url == url assert str(service) == f'WLTS:\n\tURL: {url}' assert repr(service) == f'wlts(url="{url}")'