Skip to content

Commit

Permalink
STAC verification and small descrption on test function
Browse files Browse the repository at this point in the history
  • Loading branch information
joaherrerama committed Dec 9, 2021
1 parent 0ba6634 commit 8667d66
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions tests/test_async_processing_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@
except ModuleNotFoundError:
from test_resource_base import ActiniaResourceTestCaseBase, URL_PREFIX

try:
import actinia_stac_plugin
no_stac_plugin = False
except Exception:
no_stac_plugin = True

__license__ = "GPLv3"
__author__ = "Sören Gebbert"
__copyright__ = "Copyright 2016-2018, Sören Gebbert and mundialis GmbH & Co. KG"
__copyright__ = "Copyright 2016-2021, Sören Gebbert and mundialis GmbH & Co. KG"
__maintainer__ = "Sören Gebbert"
__email__ = "soerengebbert@googlemail.com"

Expand Down Expand Up @@ -224,9 +230,9 @@
"module": "importer",
"inputs": [{
"import_descr": {
"source": "stac.STAC_Others.rastercube.sentinel-s2-l2a",
"source": "stac.defaultStac.rastercube.landsat-8-l1-c1",
"type": "stac",
"semantic_label": "red",
"semantic_label": "B1",
"extent": {
"spatial": {
"bbox": [[30.192, -16.369, 42.834, -0.264]]
Expand Down Expand Up @@ -405,9 +411,11 @@ def test_sentinel_import_error(self):
http_status=400, status="error")

# Test for STAC
@unittest.skipIf('GOOGLE_APPLICATION_CREDENTIALS' not in os.environ and 'GOOGLE_CLOUD_PROJECT' not in os.environ,
"Test is skipped because 'GOOGLE_APPLICATION_CREDENTIALS' and 'GOOGLE_CLOUD_PROJECT' not set")
@unittest.skipIf(no_stac_plugin, "STAC Plugin not installed")
def test_stac_import(self):
"""
Code test STAC collection importation with http reponse 200
"""

endpoint = URL_PREFIX + '/locations/nc_spm_08/processing_async_export'
rv = self.server.post(endpoint,
Expand All @@ -418,10 +426,12 @@ def test_stac_import(self):
self.waitAsyncStatusAssertHTTP(rv, headers=self.admin_auth_header,
http_status=200, status="finished")

@unittest.skipIf('GOOGLE_APPLICATION_CREDENTIALS' not in os.environ and 'GOOGLE_CLOUD_PROJECT' not in os.environ,
"Test is skipped because 'GOOGLE_APPLICATION_CREDENTIALS' and 'GOOGLE_CLOUD_PROJECT' not set")
@unittest.skipIf(no_stac_plugin, "STAC Plugin not installed")
def test_stac_source_error_import(self):

"""
Code test STAC collection importation with http reponse 400,
raising error on misstructured, undefined, or missing source ID.
"""
endpoint = URL_PREFIX + '/locations/nc_spm_08/processing_async_export'
rv = self.server.post(endpoint,
headers=self.admin_auth_header,
Expand All @@ -431,10 +441,14 @@ def test_stac_source_error_import(self):
self.waitAsyncStatusAssertHTTP(rv, headers=self.admin_auth_header,
http_status=400, status="error")

@unittest.skipIf('GOOGLE_APPLICATION_CREDENTIALS' not in os.environ and 'GOOGLE_CLOUD_PROJECT' not in os.environ,
"Test is skipped because 'GOOGLE_APPLICATION_CREDENTIALS' and 'GOOGLE_CLOUD_PROJECT' not set")
@unittest.skipIf(no_stac_plugin, "STAC Plugin not installed")
def test_stac_source_filter_error_import(self):
"""
Code test STAC collection importation with http reponse 400,
raising error on filtering parameter such as wrong Temportal inteval
or wrong Spatial coordinates in bbox.
"""
endpoint = URL_PREFIX + '/locations/nc_spm_08/processing_async_export'
rv = self.server.post(endpoint,
headers=self.admin_auth_header,
Expand Down

0 comments on commit 8667d66

Please sign in to comment.