diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-14 18:01:27 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-05-14 18:01:27 -0700 |
commit | 7c18e1d22b16bb920c9bb9a788691820bbdb2bfa (patch) | |
tree | 0e623bc4442f8a36267607a8f32106a3f241ee9c /python/tests/api_entity_editing.py | |
parent | 1e0e890284978dc7379db707ed1fa2c902e297c6 (diff) | |
download | fatcat-7c18e1d22b16bb920c9bb9a788691820bbdb2bfa.tar.gz fatcat-7c18e1d22b16bb920c9bb9a788691820bbdb2bfa.zip |
python impl
Diffstat (limited to 'python/tests/api_entity_editing.py')
-rw-r--r-- | python/tests/api_entity_editing.py | 46 |
1 files changed, 23 insertions, 23 deletions
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) |