diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-09 00:28:51 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-06-09 00:28:51 -0700 |
commit | ce0c06ca8e694362a3bf4cde175efbe1af6e4962 (patch) | |
tree | 94347a1c9d1900bffd79092bc94eb12a6ae6ea31 /python/tests | |
parent | 1960f398fb3ae664bec0efaaa6a399a7d01675cb (diff) | |
download | fatcat-ce0c06ca8e694362a3bf4cde175efbe1af6e4962.tar.gz fatcat-ce0c06ca8e694362a3bf4cde175efbe1af6e4962.zip |
basic ORCID importer
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/files/0000-0001-8254-7103.json | 1 | ||||
-rw-r--r-- | python/tests/orcid.py | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/python/tests/files/0000-0001-8254-7103.json b/python/tests/files/0000-0001-8254-7103.json new file mode 100644 index 00000000..2bf437d0 --- /dev/null +++ b/python/tests/files/0000-0001-8254-7103.json @@ -0,0 +1 @@ +{"orcid-identifier":{"uri":"http://orcid.org/0000-0001-8254-7103","path":"0000-0001-8254-7103","host":"orcid.org"},"preferences":{"locale":"en"},"history":{"creation-method":"Member-referred","completion-date":null,"submission-date":{"value":1407501041999},"last-modified-date":{"value":1465949566770},"claimed":true,"source":null,"deactivation-date":null,"verified-email":true,"verified-primary-email":true},"person":{"last-modified-date":null,"name":{"created-date":{"value":1460755375159},"last-modified-date":{"value":1460755375159},"given-names":{"value":"Man-Hui"},"family-name":{"value":"Li"},"credit-name":null,"source":null,"visibility":"public","path":"0000-0001-8254-7103"},"other-names":{"last-modified-date":null,"other-name":null,"path":"/0000-0001-8254-7103/other-names"},"biography":{"created-date":{"value":1460755375161},"last-modified-date":{"value":1460755375161},"content":null,"visibility":"public","path":"/0000-0001-8254-7103/biography"},"researcher-urls":{"last-modified-date":null,"researcher-url":null,"path":"/0000-0001-8254-7103/researcher-urls"},"emails":{"last-modified-date":null,"email":null,"path":"/0000-0001-8254-7103/email"},"addresses":{"last-modified-date":null,"address":null,"path":"/0000-0001-8254-7103/address"},"keywords":{"last-modified-date":null,"keyword":null,"path":"/0000-0001-8254-7103/keywords"},"external-identifiers":{"last-modified-date":null,"external-identifier":null,"path":"/0000-0001-8254-7103/external-identifiers"},"path":"/0000-0001-8254-7103/person"},"activities-summary":{"last-modified-date":null,"educations":{"last-modified-date":null,"education-summary":null,"path":"/0000-0001-8254-7103/educations"},"employments":{"last-modified-date":null,"employment-summary":null,"path":"/0000-0001-8254-7103/employments"},"fundings":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-7103/fundings"},"peer-reviews":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-7103/peer-reviews"},"works":{"last-modified-date":null,"group":null,"path":"/0000-0001-8254-7103/works"},"path":"/0000-0001-8254-7103/activities"},"path":"/0000-0001-8254-7103"} diff --git a/python/tests/orcid.py b/python/tests/orcid.py new file mode 100644 index 00000000..86a23603 --- /dev/null +++ b/python/tests/orcid.py @@ -0,0 +1,15 @@ + +import pytest +from fatcat.orcid_importer import FatcatOrcidImporter + +@pytest.fixture(scope="function") +def orcid_importer(): + yield FatcatOrcidImporter("http://localhost:9411/v0") + +def test_orcid_importer_batch(orcid_importer): + with open('tests/files/0000-0001-8254-7103.json', 'r') as f: + orcid_importer.process_batch(f) + +def test_orcid_importer(orcid_importer): + with open('tests/files/0000-0001-8254-7103.json', 'r') as f: + orcid_importer.process_source(f) |