Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_trigger_lta_failed(http_status_code):
api = SentinelAPI("mock_user", "mock_password")
request_url = "https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')/$value"
with requests_mock.mock() as rqst:
rqst.get(request_url, status_code=http_status_code)
with pytest.raises(SentinelAPILTAError):
api._trigger_offline_retrieval(request_url)
def test_trigger_lta_failed(http_status_code):
api = SentinelAPI("mock_user", "mock_password")
request_url = "https://scihub.copernicus.eu/apihub/odata/v1/Products('8df46c9e-a20c-43db-a19a-4240c2ed3b8b')/$value"
with requests_mock.mock() as rqst:
rqst.get(
request_url,
status_code=http_status_code
)
with pytest.raises(SentinelAPILTAError) as excinfo:
api._trigger_offline_retrieval(request_url)