summaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-05-20 19:56:09 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-05-20 19:56:09 -0700
commit7815c6739e4ae730c7fe4589e8aa15b2b0f1033d (patch)
tree6ed0738b680e5fd22aa84e3c6d14413515bc57d2 /python/tests
parentd56a544ec64df7ce6257982bd7a02b45b2cd1af5 (diff)
downloadfatcat-7815c6739e4ae730c7fe4589e8aa15b2b0f1033d.tar.gz
fatcat-7815c6739e4ae730c7fe4589e8aa15b2b0f1033d.zip
add release expand api tests
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/api_files.py16
-rw-r--r--python/tests/api_filesets.py3
-rw-r--r--python/tests/api_misc.py6
-rw-r--r--python/tests/api_webcaptures.py3
4 files changed, 19 insertions, 9 deletions
diff --git a/python/tests/api_files.py b/python/tests/api_files.py
index 5675071e..32d4a6ee 100644
--- a/python/tests/api_files.py
+++ b/python/tests/api_files.py
@@ -60,16 +60,14 @@ def test_file(api):
def test_file_examples(api):
- api.lookup_file(sha256='ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362')
+ f1 = api.lookup_file(sha256='ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362')
+ assert f1.releases is None
- f1 = api.get_file('aaaaaaaaaaaaamztaaaaaaaaam')
+ f1 = api.get_file('aaaaaaaaaaaaamztaaaaaaaaam', expand="releases")
assert f1.sha256 == "ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362"
-
- # TODO: no "get_file_releases" or expand thing yet...
- #f1r = api.get_file_releases("aaaaaaaaaaaaamztaaaaaaaaam")
- #assert f1r
+ assert f1.releases[0].ident
# expansion (back from release)
- #r1 = api.get_release(f1r[0].ident, expand="files")
- #assert r1.files
- #assert f1.ident in [f.ident for f in r1.files]
+ r1 = api.get_release(f1.releases[0].ident, expand="files")
+ assert r1.files
+ assert f1.ident in [f.ident for f in r1.files]
diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py
index 735eb72c..94aa575d 100644
--- a/python/tests/api_filesets.py
+++ b/python/tests/api_filesets.py
@@ -74,11 +74,14 @@ def test_fileset(api):
def test_fileset_examples(api):
fs3 = api.get_fileset('aaaaaaaaaaaaaztgaaaaaaaaam')
+ assert fs3.releases is None
+ fs3 = api.get_fileset('aaaaaaaaaaaaaztgaaaaaaaaam', expand="releases")
assert fs3.urls[0].url == 'http://other-personal-blog.name/dataset/'
assert fs3.urls[1].rel == 'archive'
assert fs3.manifest[1].md5 == 'f4de91152c7ab9fdc2a128f962faebff'
assert fs3.manifest[1].extra['mimetype'] == 'application/gzip'
+ assert fs3.releases[0].ident
def test_bad_fileset(api):
diff --git a/python/tests/api_misc.py b/python/tests/api_misc.py
index ef26a6c0..6fea9d29 100644
--- a/python/tests/api_misc.py
+++ b/python/tests/api_misc.py
@@ -29,6 +29,12 @@ def test_lookup_hide_extend(api):
assert r.container.issnl
assert r.abstracts == []
+ f = api.lookup_file(sha256='ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362')
+ assert f.releases is None
+
+ f = api.lookup_file(sha256='ffc1005680cb620eec4c913437dfabbf311b535cfe16cbaeb2faec1f92afc362', expand='releases')
+ assert f.releases[0].ident == f.release_ids[0]
+
def test_unexpected_body(api):
eg = quick_eg(api)
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 394d0e47..78549b0f 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -94,10 +94,13 @@ def test_webcapture(api):
def test_webcapture_examples(api):
wc3 = api.get_webcapture('aaaaaaaaaaaaa53xaaaaaaaaam')
+ assert wc3.releases is None
+ wc3 = api.get_webcapture('aaaaaaaaaaaaa53xaaaaaaaaam', expand="releases")
assert wc3.cdx[0].surt == 'org,asheesh)/'
assert wc3.cdx[1].sha1 == 'a637f1d27d9bcb237310ed29f19c07e1c8cf0aa5'
assert wc3.archive_urls[1].rel == 'warc'
+ assert wc3.releases[0].ident
def test_bad_webcapture(api):