def test_format_url_custom_api_url(): api = SentinelAPI("user", "pw", api_url='https://scihub.copernicus.eu/dhus/') url = api._format_url() assert url.startswith('https://scihub.copernicus.eu/dhus/search') api = SentinelAPI("user", "pw", api_url='https://scihub.copernicus.eu/dhus') url = api._format_url() assert url.startswith('https://scihub.copernicus.eu/dhus/search')
def test_format_url(): api = SentinelAPI(**_api_auth) start_row = 0 url = api._format_url(offset=start_row) assert url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}'.format( rows=api.page_size, start=start_row) limit = 50 url = api._format_url(limit=limit, offset=start_row) assert url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}'.format( rows=limit, start=start_row) url = api._format_url(limit=api.page_size + 50, offset=start_row) assert url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}'.format( rows=api.page_size, start=start_row) url = api._format_url(order_by="beginposition desc", limit=api.page_size + 50, offset=10) assert url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}' \ '&orderby={orderby}'.format(rows=api.page_size, start=10, orderby="beginposition desc")
def test_format_url(): api = SentinelAPI(**_api_auth) start_row = 0 url = api._format_url(start_row=start_row) assert url == 'https://scihub.copernicus.eu/apihub/search?format=json&rows={rows}&start={start}'.format( rows=api.page_size, start=start_row)