summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/fatcat_tools/importers/arabesque.py11
-rwxr-xr-xpython/fatcat_tools/importers/cdl_dash_dat.py4
-rw-r--r--python/fatcat_tools/importers/common.py6
-rw-r--r--python/fatcat_tools/importers/crossref.py9
-rw-r--r--python/fatcat_tools/importers/grobid_metadata.py9
-rw-r--r--python/fatcat_tools/importers/journal_metadata.py9
-rw-r--r--python/fatcat_tools/importers/matched.py11
-rw-r--r--python/fatcat_tools/importers/orcid.py9
-rwxr-xr-xpython/fatcat_tools/importers/wayback_static.py2
-rw-r--r--python/fatcat_web/editing_routes.py15
-rw-r--r--python/tests/api_containers.py4
-rw-r--r--python/tests/api_creators.py4
-rw-r--r--python/tests/api_editgroups.py61
-rw-r--r--python/tests/api_entity_editing.py46
-rw-r--r--python/tests/api_entity_state.py86
-rw-r--r--python/tests/api_files.py4
-rw-r--r--python/tests/api_filesets.py8
-rw-r--r--python/tests/api_misc.py2
-rw-r--r--python/tests/api_releases.py18
-rw-r--r--python/tests/api_webcaptures.py10
-rw-r--r--python/tests/citation_efficiency.py16
-rw-r--r--python/tests/fixtures.py12
-rw-r--r--python/tests/subentity_state.py58
23 files changed, 197 insertions, 217 deletions
diff --git a/python/fatcat_tools/importers/arabesque.py b/python/fatcat_tools/importers/arabesque.py
index bf9600dc..ea38ec2f 100644
--- a/python/fatcat_tools/importers/arabesque.py
+++ b/python/fatcat_tools/importers/arabesque.py
@@ -186,14 +186,15 @@ class ArabesqueMatchImporter(EntityImporter):
self.counts['skip-update-too-many-url'] += 1
return None
existing.mimetype = existing.mimetype or fe.mimetype
- edit = self.api.update_file(existing.ident, existing, editgroup_id=self.get_editgroup_id())
+ edit = self.api.update_file(self.get_editgroup_id(), existing.ident, existing)
self._edits_inflight.append(edit)
self.counts['update'] += 1
return False
def insert_batch(self, batch):
- self.api.create_file_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_file_auto_batch(fatcat_client.FileAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/cdl_dash_dat.py b/python/fatcat_tools/importers/cdl_dash_dat.py
index 9c2bdefc..5175aa89 100755
--- a/python/fatcat_tools/importers/cdl_dash_dat.py
+++ b/python/fatcat_tools/importers/cdl_dash_dat.py
@@ -179,7 +179,7 @@ def auto_cdl_dash_dat(api, dat_path, release_id=None, editgroup_id=None):
except fatcat_client.rest.ApiException:
pass
if not release_id:
- edit = api.create_release(release, editgroup_id=editgroup_id)
+ edit = api.create_release(eg.editgroup_id, release)
release_id = edit.ident
release = api.get_release(release_id, expand="filesets")
@@ -188,7 +188,7 @@ def auto_cdl_dash_dat(api, dat_path, release_id=None, editgroup_id=None):
return (None, None, None)
fileset.release_ids = [release.ident]
- edit = api.create_fileset(fileset, editgroup_id=editgroup_id)
+ edit = api.create_fileset(eg.editgroup_id, fileset)
fileset = api.get_fileset(edit.ident)
return (editgroup_id, release, fileset)
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py
index d291aeec..282f775c 100644
--- a/python/fatcat_tools/importers/common.py
+++ b/python/fatcat_tools/importers/common.py
@@ -237,17 +237,17 @@ class EntityImporter:
def create_container(self, entity):
eg_id = self.get_editgroup_id()
self.counts['inserted.container'] += 1
- return self.api.create_container(entity, editgroup_id=eg_id)
+ return self.api.create_container(eg_id, entity)
def create_release(self, entity):
eg_id = self.get_editgroup_id()
self.counts['inserted.release'] += 1
- return self.api.create_release(entity, editgroup_id=eg_id)
+ return self.api.create_release(eg_id, entity)
def create_file(self, entity):
eg_id = self.get_editgroup_id()
self.counts['inserted.file'] += 1
- return self.api.create_file(entity, editgroup_id=eg_id)
+ return self.api.create_file(eg_id, entity)
def updated(self):
"""
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py
index 443879e7..9b1cd2c3 100644
--- a/python/fatcat_tools/importers/crossref.py
+++ b/python/fatcat_tools/importers/crossref.py
@@ -467,8 +467,9 @@ class CrossrefImporter(EntityImporter):
return True
def insert_batch(self, batch):
- self.api.create_release_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_release_auto_batch(fatcat_client.ReleaseAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/grobid_metadata.py b/python/fatcat_tools/importers/grobid_metadata.py
index 573346a1..ea627dd6 100644
--- a/python/fatcat_tools/importers/grobid_metadata.py
+++ b/python/fatcat_tools/importers/grobid_metadata.py
@@ -193,7 +193,8 @@ class GrobidMetadataImporter(EntityImporter):
return True
def insert_batch(self, batch):
- self.api.create_file_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_file_auto_batch(fatcat_client.FileAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/journal_metadata.py b/python/fatcat_tools/importers/journal_metadata.py
index 9bba2b12..89ad6fc0 100644
--- a/python/fatcat_tools/importers/journal_metadata.py
+++ b/python/fatcat_tools/importers/journal_metadata.py
@@ -122,7 +122,8 @@ class JournalMetadataImporter(EntityImporter):
return True
def insert_batch(self, batch):
- self.api.create_container_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_container_auto_batch(fatcat_client.ContainerAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py
index f3f2e141..4d78fdc9 100644
--- a/python/fatcat_tools/importers/matched.py
+++ b/python/fatcat_tools/importers/matched.py
@@ -143,13 +143,14 @@ class MatchedImporter(EntityImporter):
existing.size = existing.size or fe.size
existing.md5 = existing.md5 or fe.md5
existing.sha256 = existing.sha256 or fe.sha256
- self.api.update_file(existing.ident, existing, editgroup_id=self.get_editgroup_id())
+ self.api.update_file(self.get_editgroup_id(), existing.ident, existing)
self.counts['update'] += 1
return False
def insert_batch(self, batch):
- self.api.create_file_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_file_auto_batch(fatcat_client.FileAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/orcid.py b/python/fatcat_tools/importers/orcid.py
index 928b9627..0bdd5d19 100644
--- a/python/fatcat_tools/importers/orcid.py
+++ b/python/fatcat_tools/importers/orcid.py
@@ -89,7 +89,8 @@ class OrcidImporter(EntityImporter):
return True
def insert_batch(self, batch):
- self.api.create_creator_batch(batch,
- autoaccept=True,
- description=self.editgroup_description,
- extra=json.dumps(self.editgroup_extra))
+ self.api.create_creator_auto_batch(fatcat_client.CreatorAutoBatch(
+ editgroup=fatcat_client.Editgroup(
+ description=self.editgroup_description,
+ extra=self.editgroup_extra),
+ entity_list=batch))
diff --git a/python/fatcat_tools/importers/wayback_static.py b/python/fatcat_tools/importers/wayback_static.py
index 73779b95..72f4d658 100755
--- a/python/fatcat_tools/importers/wayback_static.py
+++ b/python/fatcat_tools/importers/wayback_static.py
@@ -207,7 +207,7 @@ def auto_wayback_static(api, release_id, wayback_url, editgroup_id=None):
git_rev=git_rev,
agent="fatcat_tools.auto_wayback_static")))
editgroup_id = eg.editgroup_id
- edit = api.create_webcapture(wc, editgroup_id=editgroup_id)
+ edit = api.create_webcapture(eg.editgroup_id, wc)
return (editgroup_id, edit)
def main():
diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py
index 98e5c27d..6895a4cd 100644
--- a/python/fatcat_web/editing_routes.py
+++ b/python/fatcat_web/editing_routes.py
@@ -63,7 +63,7 @@ def container_create():
# no merge or anything hard to do; just create the entity
entity = form.to_entity()
try:
- edit = user_api.create_container(entity, editgroup_id=eg.editgroup_id)
+ edit = user_api.create_container(eg.editgroup_id, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
@@ -98,8 +98,7 @@ def container_edit(ident):
# all the tricky logic is in the update method
form.update_entity(entity)
try:
- edit = user_api.update_container(entity.ident, entity,
- editgroup_id=eg.editgroup_id)
+ edit = user_api.update_container(eg.editgroup_id, entity.ident, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
@@ -144,7 +143,7 @@ def file_create():
# no merge or anything hard to do; just create the entity
entity = form.to_entity()
try:
- edit = user_api.create_file(entity, editgroup_id=eg.editgroup_id)
+ edit = user_api.create_file(eg.editgroup_id, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
@@ -181,8 +180,7 @@ def file_edit(ident):
# all the tricky logic is in the update method
form.update_entity(entity)
try:
- edit = user_api.update_file(entity.ident, entity,
- editgroup_id=eg.editgroup_id)
+ edit = user_api.update_file(eg.editgroup_id, entity.ident, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
@@ -238,7 +236,7 @@ def release_create():
# no merge or anything hard to do; just create the entity
entity = form.to_entity()
try:
- edit = user_api.create_release(entity, editgroup_id=eg.editgroup_id)
+ edit = user_api.create_release(eg.editgroup_id, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
@@ -274,8 +272,7 @@ def release_edit(ident):
# all the tricky logic is in the update method
form.update_entity(entity)
try:
- edit = user_api.update_release(entity.ident, entity,
- editgroup_id=eg.editgroup_id)
+ edit = user_api.update_release(eg.editgroup_id, entity.ident, entity)
except ApiException as ae:
app.log.warning(ae)
abort(ae.status)
diff --git a/python/tests/api_containers.py b/python/tests/api_containers.py
index 47825ed5..435c76af 100644
--- a/python/tests/api_containers.py
+++ b/python/tests/api_containers.py
@@ -21,7 +21,7 @@ def test_container(api):
extra=dict(a=1, b=2),
)
- c1edit = api.create_container(c1, editgroup_id=eg.editgroup_id)
+ c1edit = api.create_container(eg.editgroup_id, c1)
api.accept_editgroup(eg.editgroup_id)
c2 = api.get_container(c1edit.ident)
@@ -44,7 +44,7 @@ def test_container(api):
# delete
eg = quick_eg(api)
- api.delete_container(c2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_container(eg.editgroup_id, c2.ident)
api.accept_editgroup(eg.editgroup_id)
c2 = api.get_container(c2.ident)
assert c2.state == "deleted"
diff --git a/python/tests/api_creators.py b/python/tests/api_creators.py
index 91eedd24..b3e1194c 100644
--- a/python/tests/api_creators.py
+++ b/python/tests/api_creators.py
@@ -21,7 +21,7 @@ def test_creators(api):
extra=dict(a=1, b=5),
)
- c1edit = api.create_creator(c1, editgroup_id=eg.editgroup_id)
+ c1edit = api.create_creator(eg.editgroup_id, c1)
api.accept_editgroup(eg.editgroup_id)
c2 = api.get_creator(c1edit.ident)
@@ -44,7 +44,7 @@ def test_creators(api):
# delete
eg = quick_eg(api)
- api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c2.ident)
api.accept_editgroup(eg.editgroup_id)
c2 = api.get_creator(c2.ident)
assert c2.state == "deleted"
diff --git a/python/tests/api_editgroups.py b/python/tests/api_editgroups.py
index 722d8686..5346d909 100644
--- a/python/tests/api_editgroups.py
+++ b/python/tests/api_editgroups.py
@@ -15,7 +15,7 @@ def test_editgroup_submit(api):
c1 = CreatorEntity(display_name="test updates")
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
eg2 = api.get_editgroup(eg.editgroup_id)
assert not eg2.submitted
@@ -86,55 +86,32 @@ def test_editgroup_ordering(api):
assert r1[0].submitted <= r1[1].submitted
-def test_editgroup_autoaccept(api):
- # autoaccept changes: editgroups required when, in what combination
+def test_editgroup_auto_batch(api):
- eg = quick_eg(api)
- c1 = CreatorEntity(display_name="test autoaccept")
- c2 = CreatorEntity(display_name="test another autoaccept")
-
- with pytest.raises(fatcat_client.rest.ApiException):
- edits = api.create_creator_batch([c1, c2])
+ c1 = CreatorEntity(display_name="test auto_batch")
+ c2 = CreatorEntity(display_name="test another auto_batch")
- with pytest.raises(fatcat_client.rest.ApiException):
- edits = api.create_creator_batch([c1, c2], editgroup_id=eg.editgroup_id, autoaccept=True)
+ eg1 = api.create_creator_auto_batch(CreatorAutoBatch(
+ editgroup=Editgroup(),
+ entity_list=[c1, c2]))
- edits1 = api.create_creator_batch([c1, c2], editgroup_id=eg.editgroup_id)
- edits2 = api.create_creator_batch([c1, c2], autoaccept=True)
-
- assert edits1[0].editgroup_id == eg.editgroup_id
- assert edits1[0].editgroup_id != edits2[1].editgroup_id
- eg1 = api.get_editgroup(edits1[0].editgroup_id)
- eg2 = api.get_editgroup(edits2[0].editgroup_id)
-
- assert not eg1.changelog_index
- assert eg2.changelog_index
- #print(edits1)
- #print(eg1.edits.creators)
- assert eg1.edits.creators[0].ident in [t.ident for t in edits1]
- assert eg2.edits.creators[0].ident in [t.ident for t in edits2]
+ assert eg1.changelog_index
+ assert len(eg1.edits.creators) == 2
def test_batch_params(api):
eg = quick_eg(api)
- c1 = CreatorEntity(display_name="test autoaccept")
- c2 = CreatorEntity(display_name="test another autoaccept")
-
- with pytest.raises(fatcat_client.rest.ApiException):
- edits = api.create_creator_batch([c1, c2])
+ c1 = CreatorEntity(display_name="test auto_batch")
+ c2 = CreatorEntity(display_name="test another auto_batch")
desc = "test description"
extra = dict(a=75, q="thing")
- edits = api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra=json.dumps(extra))
- eg = api.get_editgroup(edits[0].editgroup_id)
-
- assert eg.description == desc
- assert eg.extra == extra
-
- # currently must manually json dumps() extra field
- with pytest.raises(fatcat_client.rest.ApiException):
- api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra=extra)
-
- with pytest.raises(fatcat_client.rest.ApiException):
- api.create_creator_batch([c1, c2], autoaccept=True, description=desc, extra="{")
+ eg1 = api.create_creator_auto_batch(CreatorAutoBatch(
+ editgroup=Editgroup(
+ description=desc,
+ extra=extra),
+ entity_list=[c1, c2]))
+
+ assert eg1.description == desc
+ assert eg1.extra == extra
diff --git a/python/tests/api_entity_editing.py b/python/tests/api_entity_editing.py
index eff0ca30..83f38695 100644
--- a/python/tests/api_entity_editing.py
+++ b/python/tests/api_entity_editing.py
@@ -14,20 +14,20 @@ def test_multiple_edits_same_group(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id)
+ edit = api.update_creator(eg.editgroup_id, c1.ident, c2)
# should fail with existing
with pytest.raises(fatcat_client.rest.ApiException):
- api.update_creator(c1.ident, c3, editgroup_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c3)
# ... but succeed after deleting
- api.delete_creator_edit(edit.edit_id)
- api.update_creator(c1.ident, c3, editgroup_id=eg.editgroup_id)
+ api.delete_creator_edit(edit.editgroup_id, edit.edit_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c3)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.display_name == "right"
@@ -36,7 +36,7 @@ def test_multiple_edits_same_group(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
@@ -46,13 +46,13 @@ def test_edit_after_accept(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id)
+ api.create_creator(eg.editgroup_id, c2)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -61,7 +61,7 @@ def test_edit_after_accept(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
@@ -71,7 +71,7 @@ def test_edit_deletion(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
api.accept_editgroup(eg.editgroup_id)
# try multiple edits in the same group
@@ -79,10 +79,10 @@ def test_edit_deletion(api):
eg = quick_eg(api)
eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 0
- edit = api.update_creator(c1.ident, c2, editgroup_id=eg.editgroup_id)
+ edit = api.update_creator(eg.editgroup_id, c1.ident, c2)
eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 1
- api.delete_creator_edit(edit.edit_id)
+ api.delete_creator_edit(edit.editgroup_id, edit.edit_id)
eg = api.get_editgroup(eg.editgroup_id)
assert len(eg.edits.creators) == 0
@@ -94,7 +94,7 @@ def test_edit_deletion(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
@@ -109,12 +109,12 @@ def test_delete_accepted_edit(api):
# create
eg = quick_eg(api)
- edit = api.create_creator(c1, editgroup_id=eg.editgroup_id)
+ edit = api.create_creator(eg.editgroup_id, c1)
api.accept_editgroup(eg.editgroup_id)
# try to delete
try:
- api.delete_creator_edit(edit.edit_id)
+ api.delete_creator_edit(edit.editgroup_id, edit.edit_id)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
@@ -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_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
rev = api.get_creator_revision(c1.revision)
assert "nugget" in rev.display_name
assert rev.state is None
@@ -163,13 +163,13 @@ def test_edit_delete_all(api_dummy_entities):
api = ade['api']
eg = api.get_editgroup(ade['editgroup'].editgroup_id)
- api.delete_creator_edit(eg.edits.creators[0].edit_id)
- api.delete_container_edit(eg.edits.containers[0].edit_id)
- api.delete_file_edit(eg.edits.files[0].edit_id)
- api.delete_fileset_edit(eg.edits.filesets[0].edit_id)
- api.delete_webcapture_edit(eg.edits.webcaptures[0].edit_id)
- api.delete_release_edit(eg.edits.releases[0].edit_id)
- api.delete_work_edit(eg.edits.works[0].edit_id)
+ api.delete_creator_edit(eg.editgroup_id, eg.edits.creators[0].edit_id)
+ api.delete_container_edit(eg.editgroup_id, eg.edits.containers[0].edit_id)
+ api.delete_file_edit(eg.editgroup_id, eg.edits.files[0].edit_id)
+ api.delete_fileset_edit(eg.editgroup_id, eg.edits.filesets[0].edit_id)
+ api.delete_webcapture_edit(eg.editgroup_id, eg.edits.webcaptures[0].edit_id)
+ api.delete_release_edit(eg.editgroup_id, eg.edits.releases[0].edit_id)
+ api.delete_work_edit(eg.editgroup_id, eg.edits.works[0].edit_id)
# verify deletion
eg = api.get_editgroup(ade['editgroup'].editgroup_id)
diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py
index 7fb9fac1..9ff99dab 100644
--- a/python/tests/api_entity_state.py
+++ b/python/tests/api_entity_state.py
@@ -37,8 +37,8 @@ def test_redirect_entity(api):
# create two creators
eg = quick_eg(api)
- c1_edit = api.create_creator(c1, editgroup_id=eg.editgroup_id)
- c2_edit = api.create_creator(c2, editgroup_id=eg.editgroup_id)
+ c1_edit = api.create_creator(eg.editgroup_id, c1)
+ c2_edit = api.create_creator(eg.editgroup_id, c2)
c1 = api.get_creator(c1_edit.ident)
c2 = api.get_creator(c2_edit.ident)
assert c1_edit.prev_revision is None
@@ -50,7 +50,7 @@ def test_redirect_entity(api):
# merge second into first
c2_redirect = CreatorEntity(redirect=c1.ident)
eg = quick_eg(api)
- merge_edit = api.update_creator(c2.ident, c2_redirect, editgroup_id=eg.editgroup_id)
+ merge_edit = api.update_creator(eg.editgroup_id, c2.ident, c2_redirect)
assert merge_edit.prev_revision == c2.revision
redirs = api.get_creator_redirects(c1.ident)
assert redirs == []
@@ -76,7 +76,7 @@ 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_id=eg.editgroup_id)
+ update_edit = api.update_creator(eg.editgroup_id, c1.ident, c1)
assert update_edit.prev_revision == c1.revision
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
@@ -85,7 +85,7 @@ def test_redirect_entity(api):
# delete first; check that second is deleted (but state is redirect)
eg = quick_eg(api)
- del_edit = api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ del_edit = api.delete_creator(eg.editgroup_id, c1.ident)
assert del_edit.prev_revision == update_edit.revision
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
@@ -100,7 +100,7 @@ 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_id=eg.editgroup_id)
+ undelete_edit = api.update_creator(eg.editgroup_id, c1.ident, c1)
assert undelete_edit.prev_revision is None
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
@@ -113,7 +113,7 @@ 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_id=eg.editgroup_id)
+ update_edit = api.update_creator(eg.editgroup_id, c2.ident, c2)
# prev_revision should be none after an un-redirect
assert update_edit.prev_revision is None
redirs = api.get_creator_redirects(c1.ident)
@@ -129,8 +129,8 @@ def test_redirect_entity(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
- api.delete_creator(c2.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
+ api.delete_creator(eg.editgroup_id, c2.ident)
api.accept_editgroup(eg.editgroup_id)
@@ -151,7 +151,7 @@ def test_delete_entity(api):
# create
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "active"
@@ -162,10 +162,10 @@ def test_delete_entity(api):
# delete
eg = quick_eg(api)
- api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
with pytest.raises(fatcat_client.rest.ApiException):
# can't re-delete in same editgroup
- api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "deleted"
@@ -177,7 +177,7 @@ def test_delete_entity(api):
eg = quick_eg(api)
try:
# can't re-delete an entity
- api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
#api.accept_editgroup(eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
@@ -185,7 +185,7 @@ def test_delete_entity(api):
# undelete
eg = quick_eg(api)
- api.update_creator(c1.ident, c1, editgroup_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c1)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
assert res.state == "active"
@@ -196,7 +196,7 @@ def test_delete_entity(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
@@ -231,9 +231,9 @@ def test_recursive_redirects_entity(api):
# create three creators
eg = quick_eg(api)
- 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)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
+ c2 = api.get_creator(api.create_creator(eg.editgroup_id, c2).ident)
+ c3 = api.get_creator(api.create_creator(eg.editgroup_id, c3).ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.display_name == "test three"
@@ -241,7 +241,7 @@ def test_recursive_redirects_entity(api):
# redirect third to second
c3_redirect = CreatorEntity(redirect=c2.ident)
eg = quick_eg(api)
- api.update_creator(c3.ident, c3_redirect, editgroup_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c3.ident, c3_redirect)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.display_name == "test two"
@@ -249,7 +249,7 @@ def test_recursive_redirects_entity(api):
# 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_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c2.ident, c2_redirect)
with pytest.raises(fatcat_client.rest.ApiException):
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
@@ -262,7 +262,7 @@ 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_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c1_redirect)
with pytest.raises(fatcat_client.rest.ApiException):
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c1.ident)
@@ -271,7 +271,7 @@ def test_recursive_redirects_entity(api):
# update second; check that third updated
c2.display_name = "test two updated"
eg = quick_eg(api)
- api.update_creator(c2.ident, c2, editgroup_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c2.ident, c2)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
c2 = res
@@ -284,7 +284,7 @@ def test_recursive_redirects_entity(api):
# delete second; check that third updated
eg = quick_eg(api)
- api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c2.ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "deleted"
@@ -297,7 +297,7 @@ 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_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c2.ident, c2_undelete)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c2.ident)
assert res.state == "active"
@@ -308,7 +308,7 @@ def test_recursive_redirects_entity(api):
# delete third (a redirect)
eg = quick_eg(api)
- api.delete_creator(c3.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c3.ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "deleted"
@@ -316,7 +316,7 @@ def test_recursive_redirects_entity(api):
# re-redirect third
eg = quick_eg(api)
- api.update_creator(c3.ident, c3_redirect, editgroup_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c3.ident, c3_redirect)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "redirect"
@@ -324,7 +324,7 @@ def test_recursive_redirects_entity(api):
# delete second, then delete third
eg = quick_eg(api)
- api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c2.ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "redirect"
@@ -332,7 +332,7 @@ def test_recursive_redirects_entity(api):
with pytest.raises(fatcat_client.rest.ApiException):
res = api.lookup_creator(orcid=o2)
eg = quick_eg(api)
- api.delete_creator(c3.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c3.ident)
api.accept_editgroup(eg.editgroup_id)
res = api.get_creator(c3.ident)
assert res.state == "deleted"
@@ -340,7 +340,7 @@ def test_recursive_redirects_entity(api):
# cleanup
eg = quick_eg(api)
- api.delete_creator(c1.ident, eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
# c2 already deleted
# c3 already deleted
api.accept_editgroup(eg.editgroup_id)
@@ -352,14 +352,14 @@ def test_self_redirect(api):
# create creator
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id)
+ merge_edit = api.update_creator(eg.editgroup_id, c1.ident, c1_redirect)
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_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id).ident)
+ c2 = api.get_creator(api.create_creator(eg.editgroup_id, c2).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_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c1_redirect)
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_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id)
+ api.create_creator(eg.editgroup_id, c2)
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", ext_ids=ReleaseExtIds())
eg = quick_eg(api)
- r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
api.accept_editgroup(eg.editgroup_id)
r2 = ReleaseEntity(title="blah", redirect=c1.ident, ext_ids=ReleaseExtIds())
eg = quick_eg(api)
try:
- api.create_release(r2, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r2)
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_id=eg.editgroup_id)
+ api.create_creator(eg.editgroup_id, c1)
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_id=eg.editgroup_id)
+ api.create_container(eg.editgroup_id, c1)
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(ext_ids=ReleaseExtIds())
- api.create_release(c1, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, c1)
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_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).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_id=eg.editgroup_id)
+ api.update_creator(eg.editgroup_id, c1.ident, c1_revert)
assert False
except fatcat_client.rest.ApiException as e:
assert 400 <= e.status < 500
diff --git a/python/tests/api_files.py b/python/tests/api_files.py
index 5079188d..8d7c94d5 100644
--- a/python/tests/api_files.py
+++ b/python/tests/api_files.py
@@ -26,7 +26,7 @@ def test_file(api):
release_ids=[],
)
- f1edit = api.create_file(f1, editgroup_id=eg.editgroup_id)
+ f1edit = api.create_file(eg.editgroup_id, f1)
api.accept_editgroup(eg.editgroup_id)
f2 = api.get_file(f1edit.ident)
@@ -50,7 +50,7 @@ def test_file(api):
# delete
eg = quick_eg(api)
- api.delete_file(f2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_file(eg.editgroup_id, f2.ident)
api.accept_editgroup(eg.editgroup_id)
f2 = api.get_file(f2.ident)
assert f2.state == "deleted"
diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py
index 7838d769..4ed3d877 100644
--- a/python/tests/api_filesets.py
+++ b/python/tests/api_filesets.py
@@ -12,7 +12,7 @@ def test_fileset(api):
eg = quick_eg(api)
r1 = ReleaseEntity(title="test fileset release", ext_ids=ReleaseExtIds())
- r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
+ r1edit = api.create_release(eg.editgroup_id, r1)
fs1 = FilesetEntity(
manifest = [
@@ -40,7 +40,7 @@ def test_fileset(api):
release_ids = [r1edit.ident],
)
- fs1edit = api.create_fileset(fs1, editgroup_id=eg.editgroup_id)
+ fs1edit = api.create_fileset(eg.editgroup_id, fs1)
api.accept_editgroup(eg.editgroup_id)
fs2 = api.get_fileset(fs1edit.ident)
@@ -63,7 +63,7 @@ def test_fileset(api):
# delete
eg = quick_eg(api)
- api.delete_fileset(fs2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_fileset(eg.editgroup_id, fs2.ident)
api.accept_editgroup(eg.editgroup_id)
fs2 = api.get_fileset(fs2.ident)
assert fs2.state == "deleted"
@@ -90,5 +90,5 @@ def test_bad_fileset(api):
for b in bad_list:
with pytest.raises(fatcat_client.rest.ApiException):
- api.create_fileset(b, editgroup_id=eg.editgroup_id)
+ api.create_fileset(eg.editgroup_id, b)
diff --git a/python/tests/api_misc.py b/python/tests/api_misc.py
index 27d64025..ef26a6c0 100644
--- a/python/tests/api_misc.py
+++ b/python/tests/api_misc.py
@@ -38,5 +38,5 @@ def test_unexpected_body(api):
sha1="88888888888888892dd2657a1e3c992b5dc45dd2",
)
f1.urls = [dict(url="http://thing", rel="repository", asdf="blue")]
- api.create_file(f1, editgroup_id=eg.editgroup_id)
+ api.create_file(eg.editgroup_id, f1)
diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py
index 5965ae4e..9e72eb65 100644
--- a/python/tests/api_releases.py
+++ b/python/tests/api_releases.py
@@ -71,7 +71,7 @@ def test_release(api):
)
r1.bogus = "asdf"
- r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
+ r1edit = api.create_release(eg.editgroup_id, r1)
api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r1edit.ident)
@@ -131,7 +131,7 @@ def test_release(api):
# delete
eg = quick_eg(api)
- api.delete_release(r2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_release(eg.editgroup_id, r2.ident)
api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r2.ident)
assert r2.state == "deleted"
@@ -178,14 +178,14 @@ def test_empty_fields(api):
title="something",
contribs=[ReleaseContrib(raw_name="somebody")],
ext_ids=ReleaseExtIds())
- r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
+ r1edit = api.create_release(eg.editgroup_id, r1)
with pytest.raises(fatcat_client.rest.ApiException):
r2 = ReleaseEntity(title="", ext_ids=ReleaseExtIds())
- api.create_release(r2, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r2)
with pytest.raises(fatcat_client.rest.ApiException):
r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")], ext_ids=ReleaseExtIds())
- api.create_release(r2, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r2)
def test_controlled_vocab(api):
@@ -193,13 +193,13 @@ def test_controlled_vocab(api):
r1 = ReleaseEntity(title="something", release_type="journal-thingie", ext_ids=ReleaseExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
- api.create_release(r1, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r1)
r1.release_type = "article"
- api.create_release(r1, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r1)
r2 = ReleaseEntity(title="something elase", release_stage="pre-print", ext_ids=ReleaseExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
- api.create_release(r2, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r2)
r2.release_stage = "published"
- api.create_release(r2, editgroup_id=eg.editgroup_id)
+ api.create_release(eg.editgroup_id, r2)
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 896c9d8a..2b3deb95 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -13,7 +13,7 @@ def test_webcapture(api):
eg = quick_eg(api)
r1 = ReleaseEntity(title="test webcapture release", ext_ids=ReleaseExtIds())
- r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
+ r1edit = api.create_release(eg.editgroup_id, r1)
wc1 = WebcaptureEntity(
original_url = "http://example.site",
@@ -49,7 +49,7 @@ def test_webcapture(api):
release_ids = [r1edit.ident],
)
- wc1edit = api.create_webcapture(wc1, editgroup_id=eg.editgroup_id)
+ wc1edit = api.create_webcapture(eg.editgroup_id, wc1)
api.accept_editgroup(eg.editgroup_id)
wc2 = api.get_webcapture(wc1edit.ident)
@@ -83,7 +83,7 @@ def test_webcapture(api):
# delete
eg = quick_eg(api)
- api.delete_webcapture(wc2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_webcapture(eg.editgroup_id, wc2.ident)
api.accept_editgroup(eg.editgroup_id)
wc2 = api.get_webcapture(wc2.ident)
assert wc2.state == "deleted"
@@ -144,10 +144,10 @@ def test_bad_webcapture(api):
timestamp="20120102030405")]),
]
- api.create_webcapture(good, editgroup_id=eg.editgroup_id)
+ api.create_webcapture(eg.editgroup_id, good)
for b in bad_list:
with pytest.raises(fatcat_client.rest.ApiException):
- api.create_webcapture(b, editgroup_id=eg.editgroup_id)
+ api.create_webcapture(eg.editgroup_id, b)
with pytest.raises(ValueError):
# missing/empty CDX url
diff --git a/python/tests/citation_efficiency.py b/python/tests/citation_efficiency.py
index e4add80c..b447ca56 100644
--- a/python/tests/citation_efficiency.py
+++ b/python/tests/citation_efficiency.py
@@ -18,7 +18,7 @@ def test_citation_indexing(api):
ReleaseRef(key="second", title="the second title"),
ReleaseRef(key="third", title="a third title"),
]
- r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
api.accept_editgroup(eg.editgroup_id)
assert r1.refs[0].index == 0
@@ -30,7 +30,7 @@ def test_citation_indexing(api):
r1.refs.pop(1)
eg = quick_eg(api)
- api.update_release(r1.ident, r1, editgroup_id=eg.editgroup_id)
+ api.update_release(eg.editgroup_id, r1.ident, r1)
api.accept_editgroup(eg.editgroup_id)
r1 = api.get_release(r1.ident)
@@ -45,18 +45,18 @@ def test_citation_targets(api):
eg = quick_eg(api)
r1 = ReleaseEntity(title="the target", ext_ids=ReleaseExtIds())
- r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
r2 = ReleaseEntity(title="the citer", ext_ids=ReleaseExtIds())
r2.refs = [
ReleaseRef(key="first", title="something else"),
ReleaseRef(key="second", title="the target title"),
]
- r2 = api.get_release(api.create_release(r2, editgroup_id=eg.editgroup_id).ident)
+ r2 = api.get_release(api.create_release(eg.editgroup_id, r2).ident)
api.accept_editgroup(eg.editgroup_id)
eg = quick_eg(api)
r2.refs[1].target_release_id = r1.ident
- api.update_release(r2.ident, r2, editgroup_id=eg.editgroup_id)
+ api.update_release(eg.editgroup_id, r2.ident, r2)
api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r2.ident)
assert r2.refs[0].key == "first"
@@ -76,8 +76,8 @@ def test_citation_empty_array(api):
r2.refs = []
eg = quick_eg(api)
- 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)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
+ r2 = api.get_release(api.create_release(eg.editgroup_id, r2).ident)
api.accept_editgroup(eg.editgroup_id)
print(r1.refs)
@@ -103,7 +103,7 @@ def test_citation_encoding(api):
]
eg = quick_eg(api)
- r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
api.accept_editgroup(eg.editgroup_id)
assert title == r1.refs[0].title
diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py
index 0a014823..d958b5dc 100644
--- a/python/tests/fixtures.py
+++ b/python/tests/fixtures.py
@@ -57,13 +57,13 @@ def api_dummy_entities(api):
)
eg = quick_eg(api)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
- j1 = api.get_container(api.create_container(j1, editgroup_id=eg.editgroup_id).ident)
- r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
+ j1 = api.get_container(api.create_container(eg.editgroup_id, j1).ident)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
w1 = api.get_work(r1.work_id)
- f1 = api.get_file(api.create_file(f1, editgroup_id=eg.editgroup_id).ident)
- fs1 = api.get_fileset(api.create_fileset(fs1, editgroup_id=eg.editgroup_id).ident)
- wc1 = api.get_webcapture(api.create_webcapture(wc1, editgroup_id=eg.editgroup_id).ident)
+ f1 = api.get_file(api.create_file(eg.editgroup_id, f1).ident)
+ fs1 = api.get_fileset(api.create_fileset(eg.editgroup_id, fs1).ident)
+ wc1 = api.get_webcapture(api.create_webcapture(eg.editgroup_id, wc1).ident)
return {
"api": api,
diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py
index 2b71e04a..aca0379c 100644
--- a/python/tests/subentity_state.py
+++ b/python/tests/subentity_state.py
@@ -34,20 +34,20 @@ def test_relation_states(api, app):
# WIP container
eg = quick_eg(api)
- j2 = api.get_container(api.create_container(j2, editgroup_id=eg.editgroup_id).ident)
+ j2 = api.get_container(api.create_container(eg.editgroup_id, j2).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_id=eg.editgroup_id).ident)
- c1 = api.get_creator(api.create_creator(c1, editgroup_id=eg.editgroup_id).ident)
+ j1 = api.get_container(api.create_container(eg.editgroup_id, j1).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
r1.container_id = j1.ident
r1.contribs = [ReleaseContrib(creator_id=c1.ident)]
- 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)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
+ r2 = api.get_release(api.create_release(eg.editgroup_id, r2).ident)
f1.release_ids = [r1.ident]
- f1 = api.get_file(api.create_file(f1, editgroup_id=eg.editgroup_id).ident)
+ f1 = api.get_file(api.create_file(eg.editgroup_id, f1).ident)
api.accept_editgroup(eg.editgroup_id)
r1 = api.get_release(r1.ident, expand="container,creators,files")
@@ -61,7 +61,7 @@ def test_relation_states(api, app):
# delete creator
eg = quick_eg(api)
- api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
+ api.delete_creator(eg.editgroup_id, c1.ident)
api.accept_editgroup(eg.editgroup_id)
rv = app.get('/creator/{}'.format(c1.ident))
assert rv.status_code == 200 # TODO: HTTP status "Gone"?
@@ -82,7 +82,7 @@ def test_relation_states(api, app):
# wip container
eg = quick_eg(api)
r1.container_id = j2.ident
- api.update_release(r1.ident, r1, editgroup_id=eg.editgroup_id)
+ api.update_release(eg.editgroup_id, r1.ident, r1)
api.accept_editgroup(eg.editgroup_id)
r1 = api.get_release(r1.ident, expand="container,creators,files")
@@ -100,9 +100,9 @@ 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, ext_ids=ReleaseExtIds()), editgroup_id=eg.editgroup_id)
+ api.update_release(eg.editgroup_id, r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseExtIds()))
f2.release_ids = [r2.ident]
- f2 = api.get_file(api.create_file(f2, editgroup_id=eg.editgroup_id).ident)
+ f2 = api.get_file(api.create_file(eg.editgroup_id, f2).ident)
api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.container_id == j2.ident
@@ -120,7 +120,7 @@ def test_relation_states(api, app):
# delete release
eg = quick_eg(api)
- api.delete_release(r2.ident, editgroup_id=eg.editgroup_id)
+ api.delete_release(eg.editgroup_id, r2.ident)
api.accept_editgroup(eg.editgroup_id)
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.container_id is None
@@ -147,26 +147,26 @@ def test_app_entity_states(api, app):
# create inter-related entities
eg = quick_eg(api)
- 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)
+ j1 = api.get_container(api.create_container(eg.editgroup_id, j1).ident)
+ j2 = api.get_container(api.create_container(eg.editgroup_id, j2).ident)
+ c1 = api.get_creator(api.create_creator(eg.editgroup_id, c1).ident)
+ c2 = api.get_creator(api.create_creator(eg.editgroup_id, c2).ident)
r1.container_id = j1.ident
r1.contribs = [ReleaseContrib(creator_id=c1.ident)]
- 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)
+ r1 = api.get_release(api.create_release(eg.editgroup_id, r1).ident)
+ r2 = api.get_release(api.create_release(eg.editgroup_id, r2).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)
+ f1 = api.get_file(api.create_file(eg.editgroup_id, f1).ident)
+ f2 = api.get_file(api.create_file(eg.editgroup_id, f2).ident)
api.accept_editgroup(eg.editgroup_id)
# create redirects
eg = quick_eg(api)
- 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, ext_ids=ReleaseExtIds()), editgroup_id=eg.editgroup_id)
- api.update_work(r2.work_id, WorkEntity(redirect=r1.work_id), editgroup_id=eg.editgroup_id)
+ api.update_container(eg.editgroup_id, j2.ident, ContainerEntity(redirect=j1.ident))
+ api.update_creator(eg.editgroup_id, c2.ident, CreatorEntity(redirect=c1.ident))
+ api.update_file(eg.editgroup_id, f2.ident, FileEntity(redirect=f1.ident))
+ api.update_release(eg.editgroup_id, r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseExtIds()))
+ api.update_work(eg.editgroup_id, r2.work_id, WorkEntity(redirect=r1.work_id))
api.accept_editgroup(eg.editgroup_id)
# all entities
@@ -193,11 +193,11 @@ def test_app_entity_states(api, app):
# delete targets
eg = quick_eg(api)
- 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.delete_container(eg.editgroup_id, j1.ident)
+ api.delete_creator(eg.editgroup_id, c1.ident)
+ api.delete_file(eg.editgroup_id, f1.ident)
+ api.delete_release(eg.editgroup_id, r1.ident)
+ api.delete_work(eg.editgroup_id, r1.work_id)
api.accept_editgroup(eg.editgroup_id)
# all entities