summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-07 18:23:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-07 18:23:09 -0700
commitfb4b999d5a7d36acd29e26d36c37f1a57dab0eb6 (patch)
treec7ab473a3071c5488684de73e904eb5634001b30 /python
parent75a824c0fd5697f7748f57f09e022bce97d32e0c (diff)
downloadfatcat-fb4b999d5a7d36acd29e26d36c37f1a57dab0eb6.tar.gz
fatcat-fb4b999d5a7d36acd29e26d36c37f1a57dab0eb6.zip
basic tests for entity deletion, fetch redirects
Diffstat (limited to 'python')
-rw-r--r--python/tests/api_containers.py10
-rw-r--r--python/tests/api_creators.py10
-rw-r--r--python/tests/api_files.py10
-rw-r--r--python/tests/api_filesets.py10
-rw-r--r--python/tests/api_releases.py14
-rw-r--r--python/tests/api_webcaptures.py10
6 files changed, 64 insertions, 0 deletions
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')