From fb4b999d5a7d36acd29e26d36c37f1a57dab0eb6 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 7 May 2019 18:23:09 -0700 Subject: basic tests for entity deletion, fetch redirects --- python/tests/api_containers.py | 10 ++++++++++ python/tests/api_creators.py | 10 ++++++++++ python/tests/api_files.py | 10 ++++++++++ python/tests/api_filesets.py | 10 ++++++++++ python/tests/api_releases.py | 14 ++++++++++++++ python/tests/api_webcaptures.py | 10 ++++++++++ 6 files changed, 64 insertions(+) diff --git a/python/tests/api_containers.py b/python/tests/api_containers.py index ad6d03be..47825ed5 100644 --- a/python/tests/api_containers.py +++ b/python/tests/api_containers.py @@ -39,6 +39,16 @@ def test_container(api): assert c2.revision == c2_rev.revision assert c2.name == c2_rev.name + # get redirects (none) + assert api.get_container_redirects(c2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_container(c2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + c2 = api.get_container(c2.ident) + assert c2.state == "deleted" + def test_container_examples(api): c1 = api.get_container('aaaaaaaaaaaaaeiraaaaaaaaam') diff --git a/python/tests/api_creators.py b/python/tests/api_creators.py index 82067b3f..91eedd24 100644 --- a/python/tests/api_creators.py +++ b/python/tests/api_creators.py @@ -39,6 +39,16 @@ def test_creators(api): assert c2.revision == c2_rev.revision assert c2.display_name == c2_rev.display_name + # get redirects (none) + assert api.get_creator_redirects(c2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_creator(c2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + c2 = api.get_creator(c2.ident) + assert c2.state == "deleted" + # TODO: test expansion of new creator/release pair (release get)? def test_creators_examples(api): diff --git a/python/tests/api_files.py b/python/tests/api_files.py index 41318e25..377b5798 100644 --- a/python/tests/api_files.py +++ b/python/tests/api_files.py @@ -45,6 +45,16 @@ def test_file(api): assert f1edit.revision == f2_rev.revision assert f2.revision == f2_rev.revision + # get redirects (none) + assert api.get_file_redirects(f2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_file(f2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + f2 = api.get_file(f2.ident) + assert f2.state == "deleted" + def test_file_examples(api): api.lookup_file(sha256='ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362') diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py index 6f3305c1..c8032326 100644 --- a/python/tests/api_filesets.py +++ b/python/tests/api_filesets.py @@ -58,6 +58,16 @@ def test_fileset(api): r1 = api.get_release(r1edit.ident, expand="filesets") assert r1.filesets[0].manifest == fs1.manifest + # get redirects (none) + assert api.get_fileset_redirects(fs2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_fileset(fs2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + fs2 = api.get_fileset(fs2.ident) + assert fs2.state == "deleted" + def test_fileset_examples(api): fs3 = api.get_fileset('aaaaaaaaaaaaaztgaaaaaaaaam') diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py index f495777c..73ce3757 100644 --- a/python/tests/api_releases.py +++ b/python/tests/api_releases.py @@ -96,6 +96,16 @@ def test_release(api): # lookup # TODO: via all; but need to generate random identifiers + # get redirects (none) + assert api.get_release_redirects(r2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_release(r2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + r2 = api.get_release(r2.ident) + assert r2.state == "deleted" + def test_release_examples(api): api.lookup_release(pmid='54321') @@ -107,6 +117,10 @@ def test_release_examples(api): assert r1.contribs[14].role == "editor" assert r1.abstracts[0].mimetype == "application/xml+jats" + api.get_release_files(r1.ident) + api.get_release_filesets(r1.ident) + api.get_release_webcaptures(r1.ident) + def test_empty_fields(api): eg = quick_eg(api) diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py index db3ef172..2d9c1ae5 100644 --- a/python/tests/api_webcaptures.py +++ b/python/tests/api_webcaptures.py @@ -74,6 +74,16 @@ def test_webcapture(api): print(r1) assert r1.webcaptures[0].cdx == wc1.cdx + # get redirects (none) + assert api.get_webcapture_redirects(wc2.ident) == [] + + # delete + eg = quick_eg(api) + api.delete_webcapture(wc2.ident, editgroup_id=eg.editgroup_id) + api.accept_editgroup(eg.editgroup_id) + wc2 = api.get_webcapture(wc2.ident) + assert wc2.state == "deleted" + def test_webcapture_examples(api): wc3 = api.get_webcapture('aaaaaaaaaaaaa53xaaaaaaaaam') -- cgit v1.2.3