diff --git a/CHANGES.rst b/CHANGES.rst index 1de9161..97697ba 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,7 +10,7 @@ Changes ======= -Version 1.0.0 (2024-08-14) +Version 1.0.0 (2024-08-19) -------------------------- - Add driver for Copernicus DataSpace EcoSystem. diff --git a/setup.py b/setup.py index b34383c..83b34c0 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # # This file is part of Brazil Data Cube BDC-Collectors. -# Copyright (C) 2023 INPE. +# Copyright (C) 2024 INPE. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -70,7 +70,7 @@ 'sentinelsat>=0.14,<1.3', 'Shapely>=1.8', 'tqdm>=4.50', - 'pystac-client>=0.6,<0.7' + 'pystac-client>=0.6,<0.8' ] packages = find_packages() diff --git a/tests/test_scihub.py b/tests/test_scihub.py index c96335d..d465380 100644 --- a/tests/test_scihub.py +++ b/tests/test_scihub.py @@ -83,7 +83,7 @@ def test_search(self, app, requests_mock, catalog_scihub): } ) - requests_mock.post(search_url, json=json_result, status_code=200, headers={'content-type': 'application/json'}) + requests_mock.get(search_url, json=json_result, status_code=200, headers={'content-type': 'application/json'}) res = provider.search('S2MSI1C', start_date='2020-01-01', end_date='2020-01-10', platform='Sentinel-2', cloud_cover=100, bbox=[-54, -12, -52, -10]) diff --git a/tests/test_utils.py b/tests/test_utils.py index d0af90c..4cc2e3e 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -22,9 +22,10 @@ import pytest import requests +import shapely.geometry from bdc_collectors.exceptions import DownloadError -from bdc_collectors.utils import download_stream, working_directory +from bdc_collectors.utils import download_stream, to_geom, working_directory @pytest.fixture @@ -81,3 +82,18 @@ def test_change_work_dir(): assert os.getcwd() == tmp assert os.getcwd() == old + + +def test_to_geom(): + for value in ["POINT(-54 -12)", shapely.geometry.Point(-53, -15), {"type": "Point", "coordinates": [-47, -10]}]: + geom = to_geom(value) + assert isinstance(geom, shapely.geometry.base.BaseGeometry) + + with pytest.raises(ValueError) as exc: + to_geom(10) + + exc.match("Invalid geometry") + + with pytest.raises(shapely.errors.GEOSException) as exc: + to_geom("PPOINT (-54 -12)") + exc.match("ParseException: Unknown type: 'PPOINT'")