Пример #1
0
    def test_collection_items(self, client):
        response = client.get("/collections/LC8SR/items?limit=1")
        data = response.get_json()

        assert response.status_code == 200
        assert stac.ItemCollection(data, validate=True)
        assert len(data["features"]) == 1
        feature = data["features"][0]
        assert stac.ItemCollection(feature, validate=True)
        assert feature["properties"]["bdc:tile"] == "221069"
        assert len(feature["assets"]) > 0
Пример #2
0
    def test_collection_items(self, client):
        response = client.get('/collections/LC8SR/items?limit=1')
        data = response.get_json()

        assert response.status_code == 200
        assert stac.ItemCollection(data, validate=True)
        assert len(data['features']) == 1
        feature = data['features'][0]
        assert stac.ItemCollection(feature, validate=True)
        assert feature['properties']['bdc:tile'] == '221069'
        assert len(feature['assets']) > 0
Пример #3
0
    def test_stac_search(self, client):
        response = client.get("/stac/search")
        assert response.status_code == 200

        data = response.get_json()

        assert stac.ItemCollection(data, validate=True)

        response = client.post("/stac/search",
                               content_type="application/json",
                               json=dict())

        assert response.status_code == 200

        data = response.get_json()

        assert stac.ItemCollection(data, validate=True)
Пример #4
0
    def test_item_empty(self, stac_objects, requests_mock):
        for k in stac_objects:
            s = stac.STAC(url + "/stac" if k != '0.9.0' else url, True)
            requests_mock.get(match_url, json=stac_objects[k]['collection.json'],
                              status_code=200,
                              headers={'content-type':'application/json'})
            collection = s.collection('my_collection1')

            requests_mock.get(match_url, json=stac_objects[k]['items.json']['features'][0],
                              status_code=200,
                              headers={'content-type':'application/json'})
            collection['links'].pop(1)
            assert collection.get_items() == stac.ItemCollection({})
Пример #5
0
    def test_stac_search_parameters_ids(self, client):
        parameters = {
            "ids": ["LC8SR-LC08_L1TP_221069_20190103_20190130_01_T1"]
        }

        response = client.post("/stac/search",
                               content_type="application/json",
                               json=parameters)

        assert response.status_code == 200

        data = response.get_json()

        assert stac.ItemCollection(data, validate=True)
Пример #6
0
    def test_stac_search_parameters(self, client):
        parameters = {
            "time": "2018-01-01/2020-01-01",
            "page": 1,
            "limit": 1,
            "bbox": [-180, -90, 180, 90],
            "collections": ["LC8SR"],
        }

        response = client.post("/stac/search",
                               content_type="application/json",
                               json=parameters)

        assert response.status_code == 200

        data = response.get_json()

        assert stac.ItemCollection(data, validate=True)
Пример #7
0
    def test_stac_search_parameters_intersects(self, client):
        parameters = {
            "time": "2018-01-01",
            "intersects": {
                "type":
                "Polygon",
                "coordinates": [[[-122.308150179, 37.488035566],
                                 [-122.597502109, 37.538869539],
                                 [-122.576687533, 37.613537207],
                                 [-122.288048600, 37.562818007],
                                 [-122.308150179, 37.488035566]]]
            }
        }
        response = client.post('/stac/search',
                               content_type='application/json',
                               json=parameters)

        assert response.status_code == 200

        data = response.get_json()

        assert stac.ItemCollection(data, validate=True)