Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Nov 15, 2023
1 parent 3b48f40 commit f186096
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import earthaccess
import pytest
import s3fs

logger = logging.getLogger(__name__)
assertions = unittest.TestCase("__init__")
Expand Down Expand Up @@ -94,3 +95,24 @@ def test_auth_can_fetch_s3_credentials():
print(
f"An error occured while trying to fetch S3 credentials for {daac['short-name']}: {e}"
)


@pytest.mark.parametrize("location", ({"daac": "podaac"}, {"provider": "pocloud"}))
def test_get_s3_credentials_lowercase_location(location):
activate_environment()
earthaccess.login(strategy="environment")
creds = earthaccess.get_s3_credentials(**location)
assert creds
assert all(
creds[key]
for key in ["accessKeyId", "secretAccessKey", "sessionToken", "expiration"]
)


@pytest.mark.parametrize("location", ({"daac": "podaac"}, {"provider": "pocloud"}))
def test_get_s3fs_session_lowercase_location(location):
activate_environment()
earthaccess.login(strategy="environment")
fs = earthaccess.get_s3fs_session(**location)
assert isinstance(fs, s3fs.S3FileSystem)
assert all(fs.storage_options[key] for key in ["key", "secret", "token"])

0 comments on commit f186096

Please sign in to comment.