From 6b1b131ba5e899a069fe280663d331932a8cbae5 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 24 Jan 2019 15:46:15 -0800 Subject: empty fields test --- python/tests/api_releases.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'python/tests') diff --git a/python/tests/api_releases.py b/python/tests/api_releases.py index ed6f24a4..247ad2c2 100644 --- a/python/tests/api_releases.py +++ b/python/tests/api_releases.py @@ -101,3 +101,16 @@ def test_release_examples(api): assert r1.contribs[0].role == "editor" assert r1.abstracts[0].mimetype == "application/xml+jats" +def test_empty_fields(api): + + eg = quick_eg(api) + + r1 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="somebody")]) + r1edit = api.create_release(r1, editgroup_id=eg.editgroup_id) + + with pytest.raises(fatcat_client.rest.ApiException): + r2 = ReleaseEntity(title="") + api.create_release(r2, editgroup_id=eg.editgroup_id) + with pytest.raises(fatcat_client.rest.ApiException): + r2 = ReleaseEntity(title="something", contribs=[ReleaseContrib(raw_name="")]) + api.create_release(r2, editgroup_id=eg.editgroup_id) -- cgit v1.2.3