summaryrefslogtreecommitdiffstats
path: root/python/tests/subentity_state.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:04:53 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-24 16:15:36 -0800
commit457c1612e29730e5b9ee2820c3ea813a1d2dd405 (patch)
tree1f3bd14dd0872bd2db752142b1f35cb0296635ae /python/tests/subentity_state.py
parentb86e007b7469ebb22a806d38aca0bccf9078e80d (diff)
downloadfatcat-457c1612e29730e5b9ee2820c3ea813a1d2dd405.tar.gz
fatcat-457c1612e29730e5b9ee2820c3ea813a1d2dd405.zip
python impl of API ident harmonization
Diffstat (limited to 'python/tests/subentity_state.py')
-rw-r--r--python/tests/subentity_state.py82
1 files changed, 41 insertions, 41 deletions
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))