summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-22 16:12:01 -0800
committerBryan Newbold <bnewbold@robocracy.org>2021-11-22 16:12:01 -0800
commit5c7f50b2f497692493bfa54ad4741fdc573352ae (patch)
treec20cce1884076fffe210ba28e1a569f93ed22827 /python
parentf3bd82c0308948a63645538bdd9511a503625499 (diff)
parentdd00cec4164c1a1c31c8d9cffb92deb2e30b2211 (diff)
downloadfatcat-5c7f50b2f497692493bfa54ad4741fdc573352ae.tar.gz
fatcat-5c7f50b2f497692493bfa54ad4741fdc573352ae.zip
Merge branch 'bnewbold-content-scope'
Diffstat (limited to 'python')
-rw-r--r--python/Pipfile.lock2
-rw-r--r--python/fatcat_tools/transforms/elasticsearch.py1
-rw-r--r--python/tests/api_files.py2
-rw-r--r--python/tests/api_filesets.py2
-rw-r--r--python/tests/api_webcaptures.py2
5 files changed, 8 insertions, 1 deletions
diff --git a/python/Pipfile.lock b/python/Pipfile.lock
index a5c26410..2c7d08b0 100644
--- a/python/Pipfile.lock
+++ b/python/Pipfile.lock
@@ -262,7 +262,7 @@
},
"fatcat-openapi-client": {
"path": "./../python_openapi_client",
- "version": "==0.4.0"
+ "version": "==0.5.0"
},
"filelock": {
"hashes": [
diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py
index d4962205..c16053ec 100644
--- a/python/fatcat_tools/transforms/elasticsearch.py
+++ b/python/fatcat_tools/transforms/elasticsearch.py
@@ -650,6 +650,7 @@ def file_to_elasticsearch(entity: FileEntity) -> Dict[str, Any]:
release_ids=entity.release_ids,
release_count=len(entity.release_ids),
mimetype=entity.mimetype,
+ content_scope=entity.content_scope,
size_bytes=entity.size,
sha1=entity.sha1,
sha256=entity.sha256,
diff --git a/python/tests/api_files.py b/python/tests/api_files.py
index 8f9caf3e..cd08eef7 100644
--- a/python/tests/api_files.py
+++ b/python/tests/api_files.py
@@ -13,6 +13,7 @@ def test_file(api):
sha1="027e7ed3ea1a40e92dd2657a1e3c992b5dc45dd2",
sha256="f1f4f18a904e76818863ccbc6141fce92b0dcb47b0d6041aec98bc6806e393c3",
mimetype="application/pdf",
+ content_scope="article",
urls=[
FileUrl(
url="https://web.archive.org/web/12345542/something.com/blah.pdf",
@@ -39,6 +40,7 @@ def test_file(api):
assert f1.sha1 == f2.sha1
assert f1.sha256 == f2.sha256
assert f1.mimetype == f2.mimetype
+ assert f1.content_scope == f2.content_scope
assert f1.extra == f2.extra
assert f1.urls == f2.urls
assert f1.release_ids == f2.release_ids
diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py
index d7654eb9..8ab658f5 100644
--- a/python/tests/api_filesets.py
+++ b/python/tests/api_filesets.py
@@ -34,6 +34,7 @@ def test_fileset(api):
FilesetUrl(url="https://humble-host.com/~user123/dataset/", rel="web"),
],
release_ids=[r1edit.ident],
+ content_scope="dataset",
extra=dict(t=4, u=9),
edit_extra=dict(test_key="filesets rule"),
)
@@ -52,6 +53,7 @@ def test_fileset(api):
assert fs1.urls == fs2.urls
assert fs1.manifest == fs2.manifest
assert fs1.release_ids == fs2.release_ids
+ assert fs1.content_scope == fs2.content_scope
assert fs1.extra == fs2.extra
# expansion
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 76bc68c0..6a477ff2 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -44,6 +44,7 @@ def test_webcapture(api):
FileUrl(rel="wayback", url="https://web.archive.org/web/"),
],
release_ids=[r1edit.ident],
+ content_scope="landing-page",
extra=dict(c=1, b=2),
edit_extra=dict(test_key="webcaptures rule"),
)
@@ -69,6 +70,7 @@ def test_webcapture(api):
assert wc1.release_ids == wc2.release_ids
assert wc1.timestamp == wc2.timestamp
assert wc1.original_url == wc2.original_url
+ assert wc1.content_scope == wc2.content_scope
assert wc1.extra == wc2.extra
# check release expansion