aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/api_entity_editing.py52
-rw-r--r--python/tests/api_entity_state.py136
-rw-r--r--python/tests/import_grobid_metadata.py2
-rw-r--r--python/tests/import_matched.py2
-rw-r--r--python/tests/subentity_state.py82
5 files changed, 137 insertions, 137 deletions
diff --git a/python/tests/api_entity_editing.py b/python/tests/api_entity_editing.py
index d14b949b..377d47a8 100644
--- a/python/tests/api_entity_editing.py
+++ b/python/tests/api_entity_editing.py
@@ -14,30 +14,30 @@ def test_multiple_edits_same_group(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# try multiple edits in the same group
eg = quick_eg(api)
c2 = CreatorEntity(display_name="left")
c3 = CreatorEntity(display_name="right")
- edit = api.update_creator(c1.ident, c2, editgroup=eg.id)
+ edit = api.update_creator(c1.ident, c2, editgroup_id=eg.editgroup_id)
# should fail with existing
with pytest.raises(fatcat_client.rest.ApiException):
- api.update_creator(c1.ident, c3, editgroup=eg.id)
+ api.update_creator(c1.ident, c3, editgroup_id=eg.editgroup_id)
# ... but succeed after deleting
api.delete_creator_edit(edit.edit_id)
- api.update_creator(c1.ident, c3, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c1.ident, c3, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.display_name == "right"
- eg = api.get_editgroup(eg.id)
+ eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 1
# cleanup
eg = quick_eg(api)
api.delete_creator(c1.ident)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_edit_after_accept(api):
@@ -46,13 +46,13 @@ def test_edit_after_accept(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# should be unable to create an edit on an old editgroup
c2 = CreatorEntity(display_name="left")
try:
- api.create_creator(c2, editgroup=eg.id)
+ api.create_creator(c2, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -62,7 +62,7 @@ def test_edit_after_accept(api):
# cleanup
eg = quick_eg(api)
api.delete_creator(c1.ident)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_edit_deletion(api):
@@ -71,36 +71,36 @@ def test_edit_deletion(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# try multiple edits in the same group
c2 = CreatorEntity(display_name="update one")
eg = quick_eg(api)
- eg = api.get_editgroup(eg.id)
+ eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 0
- edit = api.update_creator(c1.ident, c2, editgroup=eg.id)
- eg = api.get_editgroup(eg.id)
+ edit = api.update_creator(c1.ident, c2, editgroup_id=eg.editgroup_id)
+ eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 1
api.delete_creator_edit(edit.edit_id)
- eg = api.get_editgroup(eg.id)
+ eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 0
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.display_name == "test edit updates"
- eg = api.get_editgroup(eg.id)
+ eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 0
# cleanup
eg = quick_eg(api)
api.delete_creator(c1.ident)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_empty_editgroup(api):
eg = quick_eg(api)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_delete_accepted_edit(api):
@@ -109,8 +109,8 @@ def test_delete_accepted_edit(api):
# create
eg = quick_eg(api)
- edit = api.create_creator(c1, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ edit = api.create_creator(c1, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
# try to delete
try:
@@ -127,7 +127,7 @@ def test_wip_revision(api):
# fetch revision before accepting
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
rev = api.get_creator_revision(c1.revision)
assert "nugget" in rev.display_name
assert rev.state is None
@@ -135,7 +135,7 @@ def test_wip_revision(api):
assert rev.revision == c1.revision
# fetch revision after accepting
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
rev = api.get_creator_revision(c1.revision)
assert "nugget" in rev.display_name
assert rev.state is None
diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py
index 7c4ea901..823084c5 100644
--- a/python/tests/api_entity_state.py
+++ b/python/tests/api_entity_state.py
@@ -37,24 +37,24 @@ def test_redirect_entity(api):
# create two creators
eg = quick_eg(api)
- c1_edit = api.create_creator(c1, editgroup=eg.id)
- c2_edit = api.create_creator(c2, editgroup=eg.id)
+ c1_edit = api.create_creator(c1, editgroup_id=eg.editgroup_id)
+ c2_edit = api.create_creator(c2, editgroup_id=eg.editgroup_id)
c1 = api.get_creator(c1_edit.ident)
c2 = api.get_creator(c2_edit.ident)
assert c1_edit.prev_revision is None
assert c2_edit.prev_revision is None
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
redirs = api.get_creator_redirects(c1.ident)
assert redirs == []
# merge second into first
c2_redirect = CreatorEntity(redirect=c1.ident)
eg = quick_eg(api)
- merge_edit = api.update_creator(c2.ident, c2_redirect, editgroup=eg.id)
+ merge_edit = api.update_creator(c2.ident, c2_redirect, editgroup_id=eg.editgroup_id)
assert merge_edit.prev_revision == c2.revision
redirs = api.get_creator_redirects(c1.ident)
assert redirs == []
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
redirs = api.get_creator_redirects(c1.ident)
assert redirs == [c2.ident, ]
@@ -76,18 +76,18 @@ def test_redirect_entity(api):
# update first; check that get on second updates
c1.display_name = "test one one"
eg = quick_eg(api)
- update_edit = api.update_creator(c1.ident, c1, editgroup=eg.id)
+ update_edit = api.update_creator(c1.ident, c1, editgroup_id=eg.editgroup_id)
assert update_edit.prev_revision == c1.revision
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "redirect"
assert res.display_name == "test one one"
# delete first; check that second is deleted (but state is redirect)
eg = quick_eg(api)
- del_edit = api.delete_creator(c1.ident, editgroup=eg.id)
+ del_edit = api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
assert del_edit.prev_revision == update_edit.revision
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "deleted"
assert res.display_name is None
@@ -100,9 +100,9 @@ def test_redirect_entity(api):
# undelete first; check that second is a redirect
eg = quick_eg(api)
- undelete_edit = api.update_creator(c1.ident, c1, editgroup=eg.id)
+ undelete_edit = api.update_creator(c1.ident, c1, editgroup_id=eg.editgroup_id)
assert undelete_edit.prev_revision is None
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "redirect"
assert res.display_name == "test one one"
@@ -113,12 +113,12 @@ def test_redirect_entity(api):
assert c2.revision
assert c2.redirect is None
eg = quick_eg(api)
- update_edit = api.update_creator(c2.ident, c2, editgroup=eg.id)
+ update_edit = api.update_creator(c2.ident, c2, editgroup_id=eg.editgroup_id)
# prev_revision should be none after an un-redirect
assert update_edit.prev_revision is None
redirs = api.get_creator_redirects(c1.ident)
assert redirs == [c2.ident, ]
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "active"
assert res.display_name == "test two"
@@ -131,7 +131,7 @@ def test_redirect_entity(api):
eg = quick_eg(api)
api.delete_creator(c1.ident)
api.delete_creator(c2.ident)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_delete_entity(api):
@@ -151,8 +151,8 @@ def test_delete_entity(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "active"
assert res.display_name == "test deletable"
@@ -162,11 +162,11 @@ def test_delete_entity(api):
# delete
eg = quick_eg(api)
- api.delete_creator(c1.ident, editgroup=eg.id)
+ api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
# can't re-delete in same editgroup
- api.delete_creator(c1.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "deleted"
assert res.display_name is None
@@ -177,16 +177,16 @@ def test_delete_entity(api):
eg = quick_eg(api)
try:
# can't re-delete an entity
- api.delete_creator(c1.ident, editgroup=eg.id)
- #api.accept_editgroup(eg.id)
+ api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ #api.accept_editgroup(eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500 # error is 4xx
# undelete
eg = quick_eg(api)
- api.update_creator(c1.ident, c1, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c1.ident, c1, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "active"
assert res.display_name == "test deletable"
@@ -197,7 +197,7 @@ def test_delete_entity(api):
# cleanup
eg = quick_eg(api)
api.delete_creator(c1.ident)
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_recursive_redirects_entity(api):
@@ -231,27 +231,27 @@ def test_recursive_redirects_entity(api):
# create three creators
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- c2 = api.get_creator(api.create_creator(c2, editgroup=eg.id).ident)
- c3 = api.get_creator(api.create_creator(c3, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c2 = api.get_creator(api.create_creator(c2, editgroup_id=eg.editgroup_id).ident)
+ c3 = api.get_creator(api.create_creator(c3, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.display_name == "test three"
# redirect third to second
c3_redirect = CreatorEntity(redirect=c2.ident)
eg = quick_eg(api)
- api.update_creator(c3.ident, c3_redirect, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c3.ident, c3_redirect, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.display_name == "test two"
# redirect second to first: should be an error at merge time
c2_redirect = CreatorEntity(redirect=c1.ident)
eg = quick_eg(api)
- api.update_creator(c2.ident, c2_redirect, editgroup=eg.id)
+ api.update_creator(c2.ident, c2_redirect, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.display_name == "test two"
with pytest.raises(fatcat_client.rest.ApiException):
@@ -262,17 +262,17 @@ def test_recursive_redirects_entity(api):
# redirect first to third: should be an error at merge time
c1_redirect = CreatorEntity(redirect=c3.ident)
eg = quick_eg(api)
- api.update_creator(c1.ident, c1_redirect, editgroup=eg.id)
+ api.update_creator(c1.ident, c1_redirect, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.display_name == "test one"
# update second; check that third updated
c2.display_name = "test two updated"
eg = quick_eg(api)
- api.update_creator(c2.ident, c2, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c2.ident, c2, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
c2 = res
assert res.display_name == "test two updated"
@@ -284,8 +284,8 @@ def test_recursive_redirects_entity(api):
# delete second; check that third updated
eg = quick_eg(api)
- api.delete_creator(c2.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "deleted"
res = api.get_creator(c3.ident)
@@ -297,8 +297,8 @@ def test_recursive_redirects_entity(api):
# undelete second; check that third updated
eg = quick_eg(api)
c2_undelete = CreatorEntity(revision=c2.revision)
- api.update_creator(c2.ident, c2_undelete, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c2.ident, c2_undelete, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "active"
assert res.display_name == "test two updated"
@@ -308,32 +308,32 @@ def test_recursive_redirects_entity(api):
# delete third (a redirect)
eg = quick_eg(api)
- api.delete_creator(c3.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c3.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "deleted"
assert res.display_name is None
# re-redirect third
eg = quick_eg(api)
- api.update_creator(c3.ident, c3_redirect, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_creator(c3.ident, c3_redirect, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "redirect"
assert res.display_name == "test two updated"
# delete second, then delete third
eg = quick_eg(api)
- api.delete_creator(c2.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "redirect"
assert res.display_name is None
with pytest.raises(fatcat_client.rest.ApiException):
res = api.lookup_creator(orcid=o2)
eg = quick_eg(api)
- api.delete_creator(c3.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c3.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "deleted"
assert res.display_name is None
@@ -343,7 +343,7 @@ def test_recursive_redirects_entity(api):
api.delete_creator(c1.ident)
# c2 already deleted
# c3 already deleted
- api.accept_editgroup(eg.id)
+ api.accept_editgroup(eg.editgroup_id)
def test_self_redirect(api):
@@ -352,14 +352,14 @@ def test_self_redirect(api):
# create creator
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# redirect first to itself; should error on PUT
c1_redirect = CreatorEntity(redirect=c1.ident)
eg = quick_eg(api)
with pytest.raises(fatcat_client.rest.ApiException):
- merge_edit = api.update_creator(c1.ident, c1_redirect, editgroup=eg.id)
+ merge_edit = api.update_creator(c1.ident, c1_redirect, editgroup_id=eg.editgroup_id)
def test_wip_redirect(api):
@@ -367,20 +367,20 @@ def test_wip_redirect(api):
# create first
c1 = CreatorEntity(display_name="test one")
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# start creating second entity
c2 = CreatorEntity(display_name="test two")
eg = quick_eg(api)
- c2 = api.get_creator(api.create_creator(c2, editgroup=eg.id).ident)
+ c2 = api.get_creator(api.create_creator(c2, editgroup_id=eg.editgroup_id).ident)
assert c2.state == "wip"
# redirect first to second (should fail)
eg = quick_eg(api)
c1_redirect = CreatorEntity(redirect=c2.ident)
try:
- api.update_creator(c1.ident, c1_redirect, editgroup=eg.id)
+ api.update_creator(c1.ident, c1_redirect, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -392,14 +392,14 @@ def test_create_redirect(api):
# create first
c1 = CreatorEntity(display_name="test one")
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# create second
c2 = CreatorEntity(display_name="blah", redirect=c1.ident)
eg = quick_eg(api)
try:
- api.create_creator(c2, editgroup=eg.id)
+ api.create_creator(c2, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -408,12 +408,12 @@ def test_create_redirect(api):
# again with releases
r1 = ReleaseEntity(title="test one")
eg = quick_eg(api)
- r1 = api.get_release(api.create_release(r1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ 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)
eg = quick_eg(api)
try:
- api.create_release(r2, editgroup=eg.id)
+ api.create_release(r2, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -426,7 +426,7 @@ def test_required_entity_fields(api):
# Creator
try:
c1 = CreatorEntity()
- api.create_creator(c1, editgroup=eg.id)
+ api.create_creator(c1, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -435,7 +435,7 @@ def test_required_entity_fields(api):
# Container
try:
c1 = ContainerEntity()
- api.create_container(c1, editgroup=eg.id)
+ api.create_container(c1, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -444,7 +444,7 @@ def test_required_entity_fields(api):
# Release
try:
c1 = ReleaseEntity()
- api.create_release(c1, editgroup=eg.id)
+ api.create_release(c1, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -456,14 +456,14 @@ def test_revert_current_status(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# try to "revert" to current revision
eg = quick_eg(api)
c1_revert = CreatorEntity(revision=c1.revision)
try:
- api.update_creator(c1.ident, c1_revert, editgroup=eg.id)
+ api.update_creator(c1.ident, c1_revert, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
diff --git a/python/tests/import_grobid_metadata.py b/python/tests/import_grobid_metadata.py
index ee7040c9..459b247b 100644
--- a/python/tests/import_grobid_metadata.py
+++ b/python/tests/import_grobid_metadata.py
@@ -49,7 +49,7 @@ def test_file_metadata_parse(grobid_metadata_importer):
assert fe.urls[1].rel == "web"
assert fe.urls[0].url.startswith("https://web.archive.org/")
assert fe.urls[0].rel == "webarchive"
- assert len(fe.releases) == 0
+ assert len(fe.release_ids) == 0
def test_grobid_metadata_importer(grobid_metadata_importer):
with open('tests/files/example_grobid_metadata_lines.tsv', 'r') as f:
diff --git a/python/tests/import_matched.py b/python/tests/import_matched.py
index 4f2f0867..46a9ef85 100644
--- a/python/tests/import_matched.py
+++ b/python/tests/import_matched.py
@@ -31,4 +31,4 @@ def test_matched_dict_parse(matched_importer):
assert u.url.startswith("http://journals.plos.org")
if u.rel == "webarchive":
assert u.url.startswith("https://web.archive.org/")
- assert len(f.releases) == 1
+ assert len(f.release_ids) == 1
diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py
index 74fce208..03362686 100644
--- a/python/tests/subentity_state.py
+++ b/python/tests/subentity_state.py
@@ -22,7 +22,7 @@ Current set of such references:
=> work -> release
"""
-def test_relation_stats(api, app):
+def test_relation_states(api, app):
j1 = ContainerEntity(name="test journal")
j2 = ContainerEntity(name="another test journal")
@@ -34,21 +34,21 @@ def test_relation_stats(api, app):
# WIP container
eg = quick_eg(api)
- j2 = api.get_container(api.create_container(j2, editgroup=eg.id).ident)
+ j2 = api.get_container(api.create_container(j2, editgroup_id=eg.editgroup_id).ident)
rv = app.get('/container/{}'.format(j2.ident))
assert rv.status_code == 200
# create inter-related entities
eg = quick_eg(api)
- j1 = api.get_container(api.create_container(j1, editgroup=eg.id).ident)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
+ j1 = api.get_container(api.create_container(j1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
r1.container_id = j1.ident
r1.contribs = [ReleaseContrib(creator_id=c1.ident)]
- r1 = api.get_release(api.create_release(r1, editgroup=eg.id).ident)
- r2 = api.get_release(api.create_release(r2, editgroup=eg.id).ident)
- f1.releases = [r1.ident]
- f1 = api.get_file(api.create_file(f1, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r2 = api.get_release(api.create_release(r2, editgroup_id=eg.editgroup_id).ident)
+ f1.release_ids = [r1.ident]
+ f1 = api.get_file(api.create_file(f1, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
r1 = api.get_release(r1.ident, expand="container,creators,files")
assert r1.container.name == "test journal"
@@ -61,8 +61,8 @@ def test_relation_stats(api, app):
# delete creator
eg = quick_eg(api)
- api.delete_creator(c1.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
rv = app.get('/creator/{}'.format(c1.ident))
assert rv.status_code == 200 # TODO: HTTP status "Gone"?
@@ -82,8 +82,8 @@ def test_relation_stats(api, app):
# wip container
eg = quick_eg(api)
r1.container_id = j2.ident
- api.update_release(r1.ident, r1, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.update_release(r1.ident, r1, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
r1 = api.get_release(r1.ident, expand="container,creators,files")
assert r1.container_id == j2.ident
@@ -100,10 +100,10 @@ def test_relation_stats(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=eg.id)
- f2.releases = [r2.ident]
- f2 = api.get_file(api.create_file(f2, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident), 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)
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.container_id == j2.ident
assert r2.container.name == "another test journal"
@@ -120,8 +120,8 @@ def test_relation_stats(api, app):
# delete release
eg = quick_eg(api)
- api.delete_release(r2.ident, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_release(r2.ident, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.container_id is None
assert r2.container is None
@@ -147,27 +147,27 @@ def test_app_entity_states(api, app):
# create inter-related entities
eg = quick_eg(api)
- j1 = api.get_container(api.create_container(j1, editgroup=eg.id).ident)
- j2 = api.get_container(api.create_container(j2, editgroup=eg.id).ident)
- c1 = api.get_creator(api.create_creator(c1, editgroup=eg.id).ident)
- c2 = api.get_creator(api.create_creator(c2, editgroup=eg.id).ident)
+ j1 = api.get_container(api.create_container(j1, editgroup_id=eg.editgroup_id).ident)
+ j2 = api.get_container(api.create_container(j2, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c2 = api.get_creator(api.create_creator(c2, editgroup_id=eg.editgroup_id).ident)
r1.container_id = j1.ident
r1.contribs = [ReleaseContrib(creator_id=c1.ident)]
- r1 = api.get_release(api.create_release(r1, editgroup=eg.id).ident)
- r2 = api.get_release(api.create_release(r2, editgroup=eg.id).ident)
- f1.releases = [r1.ident]
- f1 = api.get_file(api.create_file(f1, editgroup=eg.id).ident)
- f2 = api.get_file(api.create_file(f2, editgroup=eg.id).ident)
- api.accept_editgroup(eg.id)
+ r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r2 = api.get_release(api.create_release(r2, editgroup_id=eg.editgroup_id).ident)
+ f1.release_ids = [r1.ident]
+ f1 = api.get_file(api.create_file(f1, editgroup_id=eg.editgroup_id).ident)
+ f2 = api.get_file(api.create_file(f2, editgroup_id=eg.editgroup_id).ident)
+ api.accept_editgroup(eg.editgroup_id)
# create redirects
eg = quick_eg(api)
- api.update_container(j2.ident, ContainerEntity(redirect=j1.ident), editgroup=eg.id)
- api.update_creator(c2.ident, CreatorEntity(redirect=c1.ident), editgroup=eg.id)
- api.update_file(f2.ident, FileEntity(redirect=f1.ident), editgroup=eg.id)
- api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident), editgroup=eg.id)
- api.update_work(r2.work_id, WorkEntity(redirect=r1.work_id), editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ 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_work(r2.work_id, WorkEntity(redirect=r1.work_id), editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
# all entities
rv = app.get('/container/{}'.format(j1.ident))
@@ -193,12 +193,12 @@ def test_app_entity_states(api, app):
# delete targets
eg = quick_eg(api)
- api.delete_container(j1.ident, editgroup=eg.id)
- api.delete_creator(c1.ident, editgroup=eg.id)
- api.delete_file(f1.ident, editgroup=eg.id)
- api.delete_release(r1.ident, editgroup=eg.id)
- api.delete_work(r1.work_id, editgroup=eg.id)
- api.accept_editgroup(eg.id)
+ api.delete_container(j1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_file(f1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_release(r1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_work(r1.work_id, editgroup_id=eg.editgroup_id)
+ api.accept_editgroup(eg.editgroup_id)
# all entities
rv = app.get('/container/{}'.format(j1.ident))