summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/tests/api_entity_state.py6
-rw-r--r--python/tests/api_filesets.py2
-rw-r--r--python/tests/api_releases.py51
-rw-r--r--python/tests/api_webcaptures.py2
-rw-r--r--python/tests/citation_efficiency.py12
-rw-r--r--python/tests/fixtures.py2
-rw-r--r--python/tests/import_crossref.py6
-rw-r--r--python/tests/subentity_state.py12
-rw-r--r--python/tests/transform_tests.py1
-rw-r--r--python/tests/web_editing.py4
-rw-r--r--python/tests/web_entity_views.py4
11 files changed, 54 insertions, 48 deletions
diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py
index 83b07a2e..f6350039 100644
--- a/python/tests/api_entity_state.py
+++ b/python/tests/api_entity_state.py
@@ -406,11 +406,11 @@ def test_create_redirect(api):
assert "redirect" in e.body
# again with releases
- r1 = ReleaseEntity(title="test one")
+ r1 = ReleaseEntity(title="test one", ext_ids=ReleaseEntityExtIds())
eg = quick_eg(api)
r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
api.accept_editgroup(eg.editgroup_id)
- r2 = ReleaseEntity(title="blah", redirect=c1.ident)
+ r2 = ReleaseEntity(title="blah", redirect=c1.ident, ext_ids=ReleaseEntityExtIds())
eg = quick_eg(api)
try:
api.create_release(r2, editgroup_id=eg.editgroup_id)
@@ -443,7 +443,7 @@ def test_required_entity_fields(api):
# Release
try:
- c1 = ReleaseEntity()
+ c1 = ReleaseEntity(ext_ids=ReleaseEntityExtIds())
api.create_release(c1, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py
index c8032326..ac233b14 100644
--- a/python/tests/api_filesets.py
+++ b/python/tests/api_filesets.py
@@ -11,7 +11,7 @@ from fixtures import *
def test_fileset(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="test fileset release")
+ r1 = ReleaseEntity(title="test fileset release", ext_ids=ReleaseEntityExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
fs1 = FilesetEntity(
diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py
index 73ce3757..23b01fb2 100644
--- a/python/tests/api_releases.py
+++ b/python/tests/api_releases.py
@@ -18,17 +18,19 @@ def test_release(api):
title="some title",
original_title="оригинальное название",
release_type="post-weblog",
- release_status="submitted",
+ release_stage="submitted",
release_date=datetime.datetime.utcnow().date(),
release_year=2015,
- doi="10.5555/12345678",
- pmid="12345",
- pmcid="PMC4321",
- wikidata_qid="Q1234",
- isbn13="978-3-16-148410-0",
- core_id="187348",
- arxiv_id="aslkdjfh",
- jstor_id="8328424",
+ ext_ids=ReleaseEntityExtIds(
+ doi="10.5555/12345678",
+ pmid="12345",
+ pmcid="PMC4321",
+ wikidata_qid="Q1234",
+ isbn13="978-3-16-148410-0",
+ core="187348",
+ arxiv="aslkdjfh",
+ jstor="8328424",
+ ),
volume="84",
issue="XII",
pages="4-99",
@@ -66,14 +68,14 @@ def test_release(api):
assert r1.release_type == r2.release_type
assert r1.release_date == r2.release_date
assert r1.release_year == r2.release_year
- assert r1.doi == r2.doi
- assert r1.pmid == r2.pmid
- assert r1.pmcid == r2.pmcid
- assert r1.wikidata_qid == r2.wikidata_qid
- assert r1.isbn13 == r2.isbn13
- assert r1.core_id == r2.core_id
- assert r1.arxiv_id == r2.arxiv_id
- assert r1.jstor_id == r2.jstor_id
+ assert r1.ext_ids.doi == r2.ext_ids.doi
+ assert r1.ext_ids.pmid == r2.ext_ids.pmid
+ assert r1.ext_ids.pmcid == r2.ext_ids.pmcid
+ assert r1.ext_ids.wikidata_qid == r2.ext_ids.wikidata_qid
+ assert r1.ext_ids.isbn13 == r2.ext_ids.isbn13
+ assert r1.ext_ids.core == r2.ext_ids.core
+ assert r1.ext_ids.arxiv == r2.ext_ids.arxiv
+ assert r1.ext_ids.jstor == r2.ext_ids.jstor
assert r1.volume == r2.volume
assert r1.issue == r2.issue
assert r1.pages == r2.pages
@@ -125,29 +127,32 @@ def test_empty_fields(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="somebody")])
+ r1 = ReleaseEntity(
+ title="something",
+ contribs=[ReleaseContrib(raw_name="somebody")],
+ ext_ids=ReleaseEntityExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- r2 = ReleaseEntity(title="")
+ r2 = ReleaseEntity(title="", ext_ids=ReleaseEntityExtIds())
api.create_release(r2, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")])
+ r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")], ext_ids=ReleaseEntityExtIds())
api.create_release(r2, editgroup_id=eg.editgroup_id)
def test_controlled_vocab(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="something", release_type="journal-thingie")
+ r1 = ReleaseEntity(title="something", release_type="journal-thingie", ext_ids=ReleaseEntityExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
api.create_release(r1, editgroup_id=eg.editgroup_id)
r1.release_type = "article"
api.create_release(r1, editgroup_id=eg.editgroup_id)
- r2 = ReleaseEntity(title="something elase", release_status="pre-print")
+ r2 = ReleaseEntity(title="something elase", release_stage="pre-print", ext_ids=ReleaseEntityExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
api.create_release(r2, editgroup_id=eg.editgroup_id)
- r2.release_status = "published"
+ r2.release_stage = "published"
api.create_release(r2, editgroup_id=eg.editgroup_id)
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 2d9c1ae5..1bba5747 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -12,7 +12,7 @@ from fixtures import *
def test_webcapture(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="test webcapture release")
+ r1 = ReleaseEntity(title="test webcapture release", ext_ids=ReleaseEntityExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
wc1 = WebcaptureEntity(
diff --git a/python/tests/citation_efficiency.py b/python/tests/citation_efficiency.py
index fe5006cc..200644cc 100644
--- a/python/tests/citation_efficiency.py
+++ b/python/tests/citation_efficiency.py
@@ -12,7 +12,7 @@ def test_citation_indexing(api):
# indexing is consistent and reacts to change
eg = quick_eg(api)
- r1 = ReleaseEntity(title="the target")
+ r1 = ReleaseEntity(title="the target", ext_ids=ReleaseEntityExtIds())
r1.refs = [
ReleaseRef(key="first", title="the first title"),
ReleaseRef(key="second", title="the second title"),
@@ -44,9 +44,9 @@ def test_citation_targets(api):
# also, updates work
eg = quick_eg(api)
- r1 = ReleaseEntity(title="the target")
+ r1 = ReleaseEntity(title="the target", ext_ids=ReleaseEntityExtIds())
r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
- r2 = ReleaseEntity(title="the citer")
+ r2 = ReleaseEntity(title="the citer", ext_ids=ReleaseEntityExtIds())
r2.refs = [
ReleaseRef(key="first", title="something else"),
ReleaseRef(key="second", title="the target title"),
@@ -70,8 +70,8 @@ def test_citation_targets(api):
def test_citation_empty_array(api):
# distinction between empty array (no citations) and no array (hidden)
- r1 = ReleaseEntity(title="citation null")
- r2 = ReleaseEntity(title="citation empty array")
+ r1 = ReleaseEntity(title="citation null", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="citation empty array", ext_ids=ReleaseEntityExtIds())
r1.refs = None
r2.refs = []
@@ -91,7 +91,7 @@ def test_citation_empty_array(api):
def test_citation_encoding(api):
# escape-only changes (eg, \u1234 whatever for ASCII)
- r1 = ReleaseEntity(title="citation encoding")
+ r1 = ReleaseEntity(title="citation encoding", ext_ids=ReleaseEntityExtIds())
title = "title-unicode \\u0050 \\\" "
container = "container-unicode ☃︎ ä ö ü スティー"
extra = extra={'a': 1, 'b': 2, 'ö': 3}
diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py
index 9d4caac5..6835b7a6 100644
--- a/python/tests/fixtures.py
+++ b/python/tests/fixtures.py
@@ -48,7 +48,7 @@ def api_dummy_entities(api):
c1 = CreatorEntity(display_name="test creator deletion")
j1 = ContainerEntity(name="test journal deletion")
- r1 = ReleaseEntity(title="test release creator deletion")
+ r1 = ReleaseEntity(title="test release creator deletion", ext_ids=ReleaseEntityExtIds())
f1 = FileEntity()
fs1 = FilesetEntity()
wc1 = WebcaptureEntity(
diff --git a/python/tests/import_crossref.py b/python/tests/import_crossref.py
index d439137d..e090da22 100644
--- a/python/tests/import_crossref.py
+++ b/python/tests/import_crossref.py
@@ -75,13 +75,13 @@ def test_crossref_dict_parse(crossref_importer):
print(r.extra)
assert r.title == "Renormalized perturbation theory by the moment method for degenerate states: Anharmonic oscillators"
- assert r.doi == "10.1002/(sici)1097-461x(1998)66:4<261::aid-qua1>3.0.co;2-t"
assert r.publisher == "Wiley-Blackwell"
assert r.release_type == "article-journal"
- assert r.release_status == "published"
+ assert r.release_stage == "published"
assert r.license_slug == "CC-BY-NC-ND"
assert r.original_title == "Renormalized perturbation theory auf deutsch"
- assert r.isbn13 == "978-3-16-148410-0"
+ assert r.ext_ids.doi == "10.1002/(sici)1097-461x(1998)66:4<261::aid-qua1>3.0.co;2-t"
+ assert r.ext_ids.isbn13 == "978-3-16-148410-0"
assert r.language == "fr"
assert 'subtitle' not in r.extra
assert 'subtitle' not in r.extra['crossref']
diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py
index 03362686..a248b296 100644
--- a/python/tests/subentity_state.py
+++ b/python/tests/subentity_state.py
@@ -27,8 +27,8 @@ def test_relation_states(api, app):
j1 = ContainerEntity(name="test journal")
j2 = ContainerEntity(name="another test journal")
c1 = CreatorEntity(display_name="test person")
- r1 = ReleaseEntity(title="test article")
- r2 = ReleaseEntity(title="another test article")
+ r1 = ReleaseEntity(title="test article", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseEntityExtIds())
f1 = FileEntity(md5="c60f5b093ef5e6caad9d7b45268be409")
f2 = FileEntity(md5="0000000000000000ad9d7b45268be409")
@@ -100,7 +100,7 @@ def test_relation_states(api, app):
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.files == []
eg = quick_eg(api)
- api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident), editgroup_id=eg.editgroup_id)
+ api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseEntityExtIds()), editgroup_id=eg.editgroup_id)
f2.release_ids = [r2.ident]
f2 = api.get_file(api.create_file(f2, editgroup_id=eg.editgroup_id).ident)
api.accept_editgroup(eg.editgroup_id)
@@ -140,8 +140,8 @@ def test_app_entity_states(api, app):
j2 = ContainerEntity(name="another test journal")
c1 = CreatorEntity(display_name="test person")
c2 = CreatorEntity(display_name="another test person")
- r1 = ReleaseEntity(title="test article")
- r2 = ReleaseEntity(title="another test article")
+ r1 = ReleaseEntity(title="test article", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseEntityExtIds())
f1 = FileEntity(md5="c60f5b093ef5e6caad9d7b45268be409")
f2 = FileEntity(md5="0000000000000000ad9d7b45268be409")
@@ -165,7 +165,7 @@ def test_app_entity_states(api, app):
api.update_container(j2.ident, ContainerEntity(redirect=j1.ident), editgroup_id=eg.editgroup_id)
api.update_creator(c2.ident, CreatorEntity(redirect=c1.ident), editgroup_id=eg.editgroup_id)
api.update_file(f2.ident, FileEntity(redirect=f1.ident), editgroup_id=eg.editgroup_id)
- api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident), editgroup_id=eg.editgroup_id)
+ api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseEntityExtIds()), editgroup_id=eg.editgroup_id)
api.update_work(r2.work_id, WorkEntity(redirect=r1.work_id), editgroup_id=eg.editgroup_id)
api.accept_editgroup(eg.editgroup_id)
diff --git a/python/tests/transform_tests.py b/python/tests/transform_tests.py
index a835ed82..15541a23 100644
--- a/python/tests/transform_tests.py
+++ b/python/tests/transform_tests.py
@@ -21,6 +21,7 @@ def test_rich_elasticsearch_convert(crossref_importer):
title="something",
release_year=1234,
license_slug="CC-BY-NC",
+ ext_ids=ReleaseEntityExtIds(),
)
r.state = 'active'
r.container = ContainerEntity(
diff --git a/python/tests/web_editing.py b/python/tests/web_editing.py
index ebe53b92..d69f18be 100644
--- a/python/tests/web_editing.py
+++ b/python/tests/web_editing.py
@@ -18,7 +18,7 @@ def test_web_release_create_merge(app_admin, api):
data={
'editgroup_id': eg.editgroup_id,
'release_type': 'badmojo',
- 'release_status': 'published',
+ 'release_stage': 'published',
'title': 'something bogus',
},
follow_redirects=True)
@@ -32,7 +32,7 @@ def test_web_release_create_merge(app_admin, api):
data={
'editgroup_id': eg.editgroup_id,
'release_type': 'article-journal',
- 'release_status': 'published',
+ 'release_stage': 'published',
'title': 'something bogus',
},
follow_redirects=True)
diff --git a/python/tests/web_entity_views.py b/python/tests/web_entity_views.py
index 8ed19b13..1adf3fdf 100644
--- a/python/tests/web_entity_views.py
+++ b/python/tests/web_entity_views.py
@@ -252,7 +252,7 @@ def test_web_release_login(full_app, app_admin):
# these fields are required
form.title.data = "Creating Releases: A Review"
form.release_type.data = "article-journal"
- form.release_status.data = "draft"
+ form.release_stage.data = "draft"
rv = app_admin.post('/release/create', data=form.data, follow_redirects=True)
assert rv.status_code == 200
@@ -261,7 +261,7 @@ def test_web_release_login(full_app, app_admin):
# these fields are required
form.title.data = "Creating Releases: A Review"
form.release_type.data = "article-journal"
- form.release_status.data = "draft"
+ form.release_stage.data = "draft"
# already merged editgroup
form.editgroup_id.data = "aaaaaaaaaaaabo53aaaaaaaaae"
rv = app_admin.post('/release/create', data=form.data, follow_redirects=True)