File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change 11import pytest
22from data .test_data import OPENSEARCH_PRODUCT_TYPES
3- from eodm .opensearch import OpenSearchClient
3+ from eodm .opensearch import OpenSearchClient , OpenSearchException
44
55
66@pytest .mark .parametrize ("opensearch_product_type" , OPENSEARCH_PRODUCT_TYPES )
@@ -14,3 +14,25 @@ def test_opensearch_search(
1414 query = {"{count}" : 3 , "{eo:productType}" : opensearch_product_type }
1515 for i in client .search (query ):
1616 assert i
17+
18+
19+ def test_opensearch_invalid_product_type (mock_opensearch_describe ):
20+ client = OpenSearchClient (
21+ "https://finder.creodias.eu/resto/api/collections/describe.xml"
22+ )
23+
24+ query = {"{count}" : 3 , "{eo:productType}" : "INVALID" }
25+ with pytest .raises (OpenSearchException ):
26+ for i in client .search (query ):
27+ i
28+
29+
30+ def test_opensearch_invalid_count (mock_opensearch_describe ):
31+ client = OpenSearchClient (
32+ "https://finder.creodias.eu/resto/api/collections/describe.xml"
33+ )
34+
35+ query = {"{count}" : - 5 , "{eo:productType}" : OPENSEARCH_PRODUCT_TYPES [0 ]}
36+ with pytest .raises (OpenSearchException ):
37+ for i in client .search (query ):
38+ i
You can’t perform that action at this time.
0 commit comments