aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/api_entity_state.py6
-rw-r--r--python/tests/api_files.py2
-rw-r--r--python/tests/api_filesets.py16
-rw-r--r--python/tests/api_releases.py16
-rw-r--r--python/tests/api_webcaptures.py20
-rw-r--r--python/tests/citation_efficiency.py12
-rw-r--r--python/tests/fixtures.py2
-rw-r--r--python/tests/subentity_state.py12
-rw-r--r--python/tests/transform_tests.py8
9 files changed, 47 insertions, 47 deletions
diff --git a/python/tests/api_entity_state.py b/python/tests/api_entity_state.py
index f6350039..7fb9fac1 100644
--- a/python/tests/api_entity_state.py
+++ b/python/tests/api_entity_state.py
@@ -406,11 +406,11 @@ def test_create_redirect(api):
assert "redirect" in e.body
# again with releases
- r1 = ReleaseEntity(title="test one", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test one", ext_ids=ReleaseExtIds())
eg = quick_eg(api)
r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
api.accept_editgroup(eg.editgroup_id)
- r2 = ReleaseEntity(title="blah", redirect=c1.ident, ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="blah", redirect=c1.ident, ext_ids=ReleaseExtIds())
eg = quick_eg(api)
try:
api.create_release(r2, editgroup_id=eg.editgroup_id)
@@ -443,7 +443,7 @@ def test_required_entity_fields(api):
# Release
try:
- c1 = ReleaseEntity(ext_ids=ReleaseEntityExtIds())
+ c1 = ReleaseEntity(ext_ids=ReleaseExtIds())
api.create_release(c1, editgroup_id=eg.editgroup_id)
assert False
except fatcat_client.rest.ApiException as e:
diff --git a/python/tests/api_files.py b/python/tests/api_files.py
index 377b5798..5079188d 100644
--- a/python/tests/api_files.py
+++ b/python/tests/api_files.py
@@ -21,7 +21,7 @@ def test_file(api):
mimetype="application/pdf",
extra=dict(a=2, b=5),
urls=[
- FileEntityUrls(url="https://web.archive.org/web/12345542/something.com/blah.pdf", rel="webarchive"),
+ FileUrl(url="https://web.archive.org/web/12345542/something.com/blah.pdf", rel="webarchive"),
],
release_ids=[],
)
diff --git a/python/tests/api_filesets.py b/python/tests/api_filesets.py
index ac233b14..7838d769 100644
--- a/python/tests/api_filesets.py
+++ b/python/tests/api_filesets.py
@@ -11,12 +11,12 @@ from fixtures import *
def test_fileset(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="test fileset release", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test fileset release", ext_ids=ReleaseExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
fs1 = FilesetEntity(
manifest = [
- FilesetEntityManifest(
+ FilesetFile(
path="data/thing.tar.gz",
size=54321,
md5="540da3ea6e448d8dfb057c05225f853a",
@@ -24,7 +24,7 @@ def test_fileset(api):
sha256="c7b49f3e84cd1b7cb0b0e3e9f632b7be7e21b4dc229df23331f880a8a7dfa75a",
extra={"a": 1, "b": 3},
),
- FilesetEntityManifest(
+ FilesetFile(
path="README.md",
size=54210,
md5="5f83592b5249671719bbed6ce91ecfa8",
@@ -34,8 +34,8 @@ def test_fileset(api):
),
],
urls = [
- FileEntityUrls(url="https://archive.org/download/fileset-123/", rel="repository"),
- FileEntityUrls(url="https://humble-host.com/~user123/dataset/", rel="web"),
+ FilesetUrl(url="https://archive.org/download/fileset-123/", rel="repository"),
+ FilesetUrl(url="https://humble-host.com/~user123/dataset/", rel="web"),
],
release_ids = [r1edit.ident],
)
@@ -82,9 +82,9 @@ def test_bad_fileset(api):
bad_list = [
# good (for testing test itself)
- #FilesetEntity(manifest=[FilesetEntityManifest(path="123.jpg", size=1234)]),
- #FilesetEntity(urls=[FileEntityUrls(url="thing", rel="blah")]),
- FilesetEntity(manifest=[FilesetEntityManifest(path="123.jpg", size="big")]),
+ #FilesetEntity(manifest=[FilesetFile(path="123.jpg", size=1234)]),
+ #FilesetEntity(urls=[FilesetUrl(url="thing", rel="blah")]),
+ FilesetEntity(manifest=[FilesetFile(path="123.jpg", size="big")]),
FilesetEntity(release_ids=["asdf"]),
]
diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py
index 52a4a548..5965ae4e 100644
--- a/python/tests/api_releases.py
+++ b/python/tests/api_releases.py
@@ -25,7 +25,7 @@ def test_release(api):
withdrawn_status="withdrawn",
withdrawn_year=2017,
withdrawn_date="2017-04-10",
- ext_ids=ReleaseEntityExtIds(
+ ext_ids=ReleaseExtIds(
doi="10.5555/12345678",
pmid="12345",
pmcid="PMC4321",
@@ -59,11 +59,11 @@ def test_release(api):
],
refs=[],
abstracts=[
- ReleaseEntityAbstracts(
+ ReleaseAbstract(
content="this is some abstract",
mimetype="text/plain",
lang="en"),
- ReleaseEntityAbstracts(
+ ReleaseAbstract(
content="this is some other abstract",
mimetype="text/plain",
lang="de"),
@@ -177,27 +177,27 @@ def test_empty_fields(api):
r1 = ReleaseEntity(
title="something",
contribs=[ReleaseContrib(raw_name="somebody")],
- ext_ids=ReleaseEntityExtIds())
+ ext_ids=ReleaseExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- r2 = ReleaseEntity(title="", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="", ext_ids=ReleaseExtIds())
api.create_release(r2, editgroup_id=eg.editgroup_id)
with pytest.raises(fatcat_client.rest.ApiException):
- r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")], ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")], ext_ids=ReleaseExtIds())
api.create_release(r2, editgroup_id=eg.editgroup_id)
def test_controlled_vocab(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="something", release_type="journal-thingie", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="something", release_type="journal-thingie", ext_ids=ReleaseExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
api.create_release(r1, editgroup_id=eg.editgroup_id)
r1.release_type = "article"
api.create_release(r1, editgroup_id=eg.editgroup_id)
- r2 = ReleaseEntity(title="something elase", release_stage="pre-print", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="something elase", release_stage="pre-print", ext_ids=ReleaseExtIds())
with pytest.raises(fatcat_client.rest.ApiException):
api.create_release(r2, editgroup_id=eg.editgroup_id)
r2.release_stage = "published"
diff --git a/python/tests/api_webcaptures.py b/python/tests/api_webcaptures.py
index 8c685b30..896c9d8a 100644
--- a/python/tests/api_webcaptures.py
+++ b/python/tests/api_webcaptures.py
@@ -12,7 +12,7 @@ from fixtures import *
def test_webcapture(api):
eg = quick_eg(api)
- r1 = ReleaseEntity(title="test webcapture release", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test webcapture release", ext_ids=ReleaseExtIds())
r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id)
wc1 = WebcaptureEntity(
@@ -20,7 +20,7 @@ def test_webcapture(api):
#timestamp = "2012-01-02T03:04:05Z",
timestamp = datetime.datetime.now(datetime.timezone.utc),
cdx = [
- WebcaptureEntityCdx(
+ WebcaptureCdxLine(
surt="site,example,)/data/thing.tar.gz",
#timestamp="2012-01-02T03:04:05Z",
timestamp=datetime.datetime.now(datetime.timezone.utc),
@@ -31,7 +31,7 @@ def test_webcapture(api):
sha1="455face3598611458efe1f072e58624790a67266",
sha256="c7b49f3e84cd1b7cb0b0e3e9f632b7be7e21b4dc229df23331f880a8a7dfa75a",
),
- WebcaptureEntityCdx(
+ WebcaptureCdxLine(
surt="site,example,)/README.md",
#timestamp="2012-01-02T03:04:05Z",
timestamp=datetime.datetime.now(datetime.timezone.utc),
@@ -44,7 +44,7 @@ def test_webcapture(api):
),
],
archive_urls = [
- FileEntityUrls(rel="wayback", url="https://web.archive.org/web/"),
+ FileUrl(rel="wayback", url="https://web.archive.org/web/"),
],
release_ids = [r1edit.ident],
)
@@ -104,7 +104,7 @@ def test_bad_webcapture(api):
good = WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
@@ -117,7 +117,7 @@ def test_bad_webcapture(api):
WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
@@ -127,7 +127,7 @@ def test_bad_webcapture(api):
WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
@@ -136,7 +136,7 @@ def test_bad_webcapture(api):
WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
surt="site,example,)/123.jpg",
url="http://example.site/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
@@ -154,7 +154,7 @@ def test_bad_webcapture(api):
WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
#url="http://example.site/123.jpg",
surt="site,example,)/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
@@ -166,7 +166,7 @@ def test_bad_webcapture(api):
WebcaptureEntity(
original_url="http://example.site/123.jpg",
timestamp="2012-01-02T03:04:05Z",
- cdx=[WebcaptureEntityCdx(
+ cdx=[WebcaptureCdxLine(
url="http://example.site/123.jpg",
surt="site,example,)/123.jpg",
sha1="455face3598611458efe1f072e58624790a67266",
diff --git a/python/tests/citation_efficiency.py b/python/tests/citation_efficiency.py
index 200644cc..e4add80c 100644
--- a/python/tests/citation_efficiency.py
+++ b/python/tests/citation_efficiency.py
@@ -12,7 +12,7 @@ def test_citation_indexing(api):
# indexing is consistent and reacts to change
eg = quick_eg(api)
- r1 = ReleaseEntity(title="the target", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="the target", ext_ids=ReleaseExtIds())
r1.refs = [
ReleaseRef(key="first", title="the first title"),
ReleaseRef(key="second", title="the second title"),
@@ -44,9 +44,9 @@ def test_citation_targets(api):
# also, updates work
eg = quick_eg(api)
- r1 = ReleaseEntity(title="the target", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="the target", ext_ids=ReleaseExtIds())
r1 = api.get_release(api.create_release(r1, editgroup_id=eg.editgroup_id).ident)
- r2 = ReleaseEntity(title="the citer", ext_ids=ReleaseEntityExtIds())
+ r2 = ReleaseEntity(title="the citer", ext_ids=ReleaseExtIds())
r2.refs = [
ReleaseRef(key="first", title="something else"),
ReleaseRef(key="second", title="the target title"),
@@ -70,8 +70,8 @@ def test_citation_targets(api):
def test_citation_empty_array(api):
# distinction between empty array (no citations) and no array (hidden)
- r1 = ReleaseEntity(title="citation null", ext_ids=ReleaseEntityExtIds())
- r2 = ReleaseEntity(title="citation empty array", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="citation null", ext_ids=ReleaseExtIds())
+ r2 = ReleaseEntity(title="citation empty array", ext_ids=ReleaseExtIds())
r1.refs = None
r2.refs = []
@@ -91,7 +91,7 @@ def test_citation_empty_array(api):
def test_citation_encoding(api):
# escape-only changes (eg, \u1234 whatever for ASCII)
- r1 = ReleaseEntity(title="citation encoding", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="citation encoding", ext_ids=ReleaseExtIds())
title = "title-unicode \\u0050 \\\" "
container = "container-unicode ☃︎ ä ö ü スティー"
extra = extra={'a': 1, 'b': 2, 'ö': 3}
diff --git a/python/tests/fixtures.py b/python/tests/fixtures.py
index 6835b7a6..0a014823 100644
--- a/python/tests/fixtures.py
+++ b/python/tests/fixtures.py
@@ -48,7 +48,7 @@ def api_dummy_entities(api):
c1 = CreatorEntity(display_name="test creator deletion")
j1 = ContainerEntity(name="test journal deletion")
- r1 = ReleaseEntity(title="test release creator deletion", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test release creator deletion", ext_ids=ReleaseExtIds())
f1 = FileEntity()
fs1 = FilesetEntity()
wc1 = WebcaptureEntity(
diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py
index a248b296..2b71e04a 100644
--- a/python/tests/subentity_state.py
+++ b/python/tests/subentity_state.py
@@ -27,8 +27,8 @@ def test_relation_states(api, app):
j1 = ContainerEntity(name="test journal")
j2 = ContainerEntity(name="another test journal")
c1 = CreatorEntity(display_name="test person")
- r1 = ReleaseEntity(title="test article", ext_ids=ReleaseEntityExtIds())
- r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test article", ext_ids=ReleaseExtIds())
+ r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseExtIds())
f1 = FileEntity(md5="c60f5b093ef5e6caad9d7b45268be409")
f2 = FileEntity(md5="0000000000000000ad9d7b45268be409")
@@ -100,7 +100,7 @@ def test_relation_states(api, app):
r2 = api.get_release(r2.ident, expand="container,creators,files")
assert r2.files == []
eg = quick_eg(api)
- api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseEntityExtIds()), editgroup_id=eg.editgroup_id)
+ api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseExtIds()), editgroup_id=eg.editgroup_id)
f2.release_ids = [r2.ident]
f2 = api.get_file(api.create_file(f2, editgroup_id=eg.editgroup_id).ident)
api.accept_editgroup(eg.editgroup_id)
@@ -140,8 +140,8 @@ def test_app_entity_states(api, app):
j2 = ContainerEntity(name="another test journal")
c1 = CreatorEntity(display_name="test person")
c2 = CreatorEntity(display_name="another test person")
- r1 = ReleaseEntity(title="test article", ext_ids=ReleaseEntityExtIds())
- r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseEntityExtIds())
+ r1 = ReleaseEntity(title="test article", ext_ids=ReleaseExtIds())
+ r2 = ReleaseEntity(title="another test article", ext_ids=ReleaseExtIds())
f1 = FileEntity(md5="c60f5b093ef5e6caad9d7b45268be409")
f2 = FileEntity(md5="0000000000000000ad9d7b45268be409")
@@ -165,7 +165,7 @@ def test_app_entity_states(api, app):
api.update_container(j2.ident, ContainerEntity(redirect=j1.ident), editgroup_id=eg.editgroup_id)
api.update_creator(c2.ident, CreatorEntity(redirect=c1.ident), editgroup_id=eg.editgroup_id)
api.update_file(f2.ident, FileEntity(redirect=f1.ident), editgroup_id=eg.editgroup_id)
- api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseEntityExtIds()), editgroup_id=eg.editgroup_id)
+ api.update_release(r2.ident, ReleaseEntity(redirect=r1.ident, ext_ids=ReleaseExtIds()), editgroup_id=eg.editgroup_id)
api.update_work(r2.work_id, WorkEntity(redirect=r1.work_id), editgroup_id=eg.editgroup_id)
api.accept_editgroup(eg.editgroup_id)
diff --git a/python/tests/transform_tests.py b/python/tests/transform_tests.py
index 15541a23..27f54d92 100644
--- a/python/tests/transform_tests.py
+++ b/python/tests/transform_tests.py
@@ -21,7 +21,7 @@ def test_rich_elasticsearch_convert(crossref_importer):
title="something",
release_year=1234,
license_slug="CC-BY-NC",
- ext_ids=ReleaseEntityExtIds(),
+ ext_ids=ReleaseExtIds(),
)
r.state = 'active'
r.container = ContainerEntity(
@@ -47,9 +47,9 @@ def test_rich_elasticsearch_convert(crossref_importer):
r.files = [FileEntity(
mimetype="application/pdf",
urls=[
- FileEntityUrls(rel="dweb", url="dat://a954329dlk/thingie"),
- FileEntityUrls(rel="webarchive", url="https://web.archive.org/web/20001122030405/http://example.com"),
- FileEntityUrls(rel="web", url="https://archive.org/details/blah/file.pdf"),
+ FileUrl(rel="dweb", url="dat://a954329dlk/thingie"),
+ FileUrl(rel="webarchive", url="https://web.archive.org/web/20001122030405/http://example.com"),
+ FileUrl(rel="web", url="https://archive.org/details/blah/file.pdf"),
],
extra={
"shadows": {},