Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Oct 16, 2023
1 parent 509e42c commit eee3f3d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/unit/test_results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import earthaccess


def test_data_links():
granules = earthaccess.search_data(
short_name="SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205",
temporal=("2020", "2022"),
count=1,
)
g = granules[0]
# `access` specified
assert g.data_links(access="direct")[0].startswith("s3://")
assert g.data_links(access="external")[0].startswith("https://")
# `in_region` specified
assert g.data_links(in_region=True)[0].startswith("s3://")
assert g.data_links(in_region=False)[0].startswith("https://")
# When `access` and `in_region` are both specified, `access` takes priority
assert g.data_links(access="direct", in_region=True)[0].startswith("s3://")
assert g.data_links(access="direct", in_region=False)[0].startswith("s3://")
assert g.data_links(access="external", in_region=True)[0].startswith("https://")
assert g.data_links(access="external", in_region=False)[0].startswith("https://")

0 comments on commit eee3f3d

Please sign in to comment.