diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-05-14 23:10:41 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-05-14 23:10:41 -0700 |
commit | c4852afdec87712e09b9cdba5b5db7e1ad1a0701 (patch) | |
tree | 3d50a3641245d0d30a0f7f4e0704ffa9d19f03a1 /tests/test_transform.py | |
parent | 4df616706146fce16dbc1fdc3b5502abd13144df (diff) | |
download | fatcat-scholar-c4852afdec87712e09b9cdba5b5db7e1ad1a0701.tar.gz fatcat-scholar-c4852afdec87712e09b9cdba5b5db7e1ad1a0701.zip |
start implementing ES transform helpers
Diffstat (limited to 'tests/test_transform.py')
-rw-r--r-- | tests/test_transform.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_transform.py b/tests/test_transform.py new file mode 100644 index 0000000..b7bdb4d --- /dev/null +++ b/tests/test_transform.py @@ -0,0 +1,19 @@ + +import pytest +from fatcat_openapi_client import ReleaseEntity + +from fatcat_scholar.es_transform import * +from fatcat_scholar.api_entities import * + +def test_es_release_from_release(): + + with open('tests/files/release_hsmo6p4smrganpb3fndaj2lon4.json', 'r') as f: + release = entity_from_json(f.read(), ReleaseEntity) + + obj = es_release_from_release(release) + d = json.loads(obj.json()) + + assert obj.ident == release.ident == "hsmo6p4smrganpb3fndaj2lon4" + assert obj.ident == release.ident == d['ident'] == "hsmo6p4smrganpb3fndaj2lon4" + assert obj.doi_registrar == "crossref" + assert obj.doi_prefix == "10.7717" |