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 7a5927c
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ jobs:
- name: Run tests
run: pytest
env:
AIRFLOW_VAR_DIMENSIONS_API_USER: ${{ secrets.AIRFLOW_VAR_DIMENSIONS_API_USER }}
AIRFLOW_VAR_DIMENSIONS_API_PASS: ${{ secrets.AIRFLOW_VAR_DIMENSIONS_API_PASS }}
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
103 changes: 103 additions & 0 deletions test/data/orcids.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
orcidid
0000-0001-8705-1000
0000-0003-2150-5828
0000-0003-2150-5828
0000-0002-0770-2940
0000-0002-5270-1197
0000-0002-7636-9758
0000-0003-4670-0347
0000-0002-5969-1251
0000-0002-0426-2134
0000-0002-0455-2086
0000-0002-3565-7243
0000-0002-0546-4133
0000-0001-5835-5179
0000-0002-1911-074
0000-0002-9991-400
0000-0002-7096-3297
0000-0002-2979-5818
0000-0003-0921-3902
0000-0002-1255-1200
0000-0001-8254-5984
0000-0002-0306-8866
0000-0003-1770-1367
0000-0003-3772-0477
0000-0003-3444-1544
0000-0002-8783-9428
0000-0001-5563-421
0000-0002-0146-4996
0000-0001-8657-4141
0000-0003-4313-0983
0000-0002-0508-4309
0000-0002-0579-7763
0009-0001-6236-6812
0000-0003-1058-6837
0000-0003-1604-5425
0000-0002-4839-418
0000-0001-8180-3267
0000-0001-9690-3180
0000-0001-9775-2839
0000-0002-3682-5536
0000-0003-2094-9128
0000-0002-8307-4931
0000-0002-9651-9231
0000-0002-8870-9641
0000-0002-8870-9641
0000-0001-9228-2436
0000-0002-6117-8764
0000-0002-3515-9252
0000-0001-6427-5490
0000-0002-8996-7327
0000-0002-0369-1148
0000-0002-5452-2037
0000-0002-8254-6124
0000-0003-3866-4833
0000-0002-6044-1022
0000-0002-0016-3438
0000-0001-9797-7106
0000-0002-1996-2969
0000-0001-9968-8631
0000-0001-5839-9876
0000-0003-1709-8692
0000-0002-9957-448
0000-0001-6789-1184
0000-0002-2979-7530
0009-0009-0017-8881
0000-0003-0477-2158
0000-0002-3723-9555
0000-0001-5259-5606
0000-0001-6047-9912
0000-0001-7158-9607
0000-0002-5590-159
0000-0003-1988-9201
0000-0002-2296-4674
0000-0002-7722-5465
0000-0002-8076-1242
0000-0002-0264-1966
0000-0002-9592-2782
0000-0002-2397-9165
0000-0002-2397-9165
0000-0001-5076-1172
0000-0003-3600-4356
0000-0003-0263-4632
0000-0001-9433-229
0000-0001-8774-7964
0009-0007-8665-7845
0000-0003-4024-3691
0000-0002-3525-2131
0000-0001-6760-8270
0000-0001-6825-702
0000-0002-7318-7158
0000-0001-7142-3455
0000-0002-5153-5625
0000-0002-1150-7929
0000-0002-4193-8180
0000-0002-5456-4878
0000-0003-0667-5941
0000-0002-8044-8969
0000-0002-5175-7420
0000-0002-5175-7420
0000-0003-0111-1362
0000-0003-1222-9366
0000-0003-4059-2445
0000-0003-4059-2445
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 7a5927c

Please sign in to comment.