Skip to content

Commit

Permalink
Getting Dimensions tests to work
Browse files Browse the repository at this point in the history
  • Loading branch information
edsu committed Jun 19, 2024
1 parent 3376e2b commit f7a8e74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rialto_airflow/harvest/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
dotenv.load_dotenv()

dimcli.login(
os.environ.get("DIMENSIONS_API_USER"),
os.environ.get("DIMENSIONS_API_PASS"),
os.environ.get("AIRFLOW_VAR_DIMENSIONS_API_USER"),
os.environ.get("AIRFLOW_VAR_DIMENSIONS_API_PASS"),
"https://app.dimensions.ai",
)

Expand Down
8 changes: 3 additions & 5 deletions test/harvest/test_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@

dotenv.load_dotenv()

dimensions_user = os.environ.get("DIMENSIONS_API_USER")
dimensions_password = os.environ.get("DIMENSIONS_API_PASS")
dimensions_user = os.environ.get("AIRFLOW_VAR_DIMENSIONS_API_USER")
dimensions_password = os.environ.get("AIRFLOW_VAR_DIMENSIONS_API_PASS")

no_auth = not (dimensions_user and dimensions_password)


@pytest.mark.skipif(no_auth, reason="no dimensions key")
def test_dimensions_doi_orcids_dict(tmpdir):
pickle_file = tmpdir / "dimensions.pickle"
dimensions_doi_orcids_dict(
"data/rialto_app/authors_2024-03-18.csv", pickle_file, limit=5
)
dimensions_doi_orcids_dict("test/data/orcids.csv", pickle_file, limit=5)
assert pickle_file.isfile()

with open(pickle_file, "rb") as handle:
Expand Down

0 comments on commit f7a8e74

Please sign in to comment.