aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/routes.py40
-rw-r--r--python/tests/subentity_state.py38
2 files changed, 40 insertions, 38 deletions
diff --git a/python/tests/routes.py b/python/tests/routes.py
index bca7cc0f..7b4ac442 100644
--- a/python/tests/routes.py
+++ b/python/tests/routes.py
@@ -9,7 +9,7 @@ from fixtures import *
def test_static_routes(app):
for route in ('/health', '/robots.txt', '/', '/about'):
rv = app.get(route)
- assert rv.status_code == 200
+ rv.raise_for_status()
assert app.get("/static/bogus/route").status_code == 404
@@ -27,16 +27,16 @@ def test_all_views(app):
assert rv.status_code == 404
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaai')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaai/history')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/aaaaaaaaaaaaaeiraaaaaaaaai/edit')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/create')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/lookup')
assert rv.status_code == 400
@@ -48,34 +48,34 @@ def test_all_views(app):
assert rv.status_code == 302
rv = app.get('/creator/aaaaaaaaaaaaaircaaaaaaaaai')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/creator/aaaaaaaaaaaaaircaaaaaaaaai/history')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/creator/aaaaaaaaaaaaaircaaaaaaaaai/edit')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/creator/lookup?orcid=0000-0003-2088-7465')
assert rv.status_code == 302
rv = app.get('/file/aaaaaaaaaaaaamztaaaaaaaaai')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/file/lookup?sha1=7d97e98f8af710c7e7fe703abc8f639e0ee507c4')
assert rv.status_code == 302
rv = app.get('/release/aaaaaaaaaaaaarceaaaaaaaaai')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/aaaaaaaaaaaaarceaaaaaaaaai/history')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/aaaaaaaaaaaaarceaaaaaaaaai/edit')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/create')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/lookup?doi=10.123/abc')
assert rv.status_code == 302
@@ -84,22 +84,22 @@ def test_all_views(app):
assert rv.status_code == 302
rv = app.get('/release/search')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/aaaaaaaaaaaaavkvaaaaaaaaai')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/aaaaaaaaaaaaavkvaaaaaaaaai/history')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/aaaaaaaaaaaaavkvaaaaaaaaai/edit')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/create')
assert rv.status_code == 404
rv = app.get('/editgroup/aaaaaaaaaaaabo53aaaaaaaaae')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/editgroup/ccccccccccccccccccccccccca')
print(rv)
@@ -110,7 +110,7 @@ def test_all_views(app):
#assert rv.status_code == 302
rv = app.get('/editor/aaaaaaaaaaaabkvkaaaaaaaaae')
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/editor/aaaaaaaaaaaabkvkaaaaaaaaae/changelog')
- assert rv.status_code == 200
+ rv.raise_for_status()
diff --git a/python/tests/subentity_state.py b/python/tests/subentity_state.py
index 03362686..799f5e03 100644
--- a/python/tests/subentity_state.py
+++ b/python/tests/subentity_state.py
@@ -36,7 +36,7 @@ def test_relation_states(api, app):
eg = quick_eg(api)
j2 = api.get_container(api.create_container(j2, editgroup_id=eg.editgroup_id).ident)
rv = app.get('/container/{}'.format(j2.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
# create inter-related entities
eg = quick_eg(api)
@@ -57,14 +57,15 @@ def test_relation_states(api, app):
assert r1.contribs[0].creator.display_name == "test person"
assert r1.contribs[0].creator.state == "active"
rv = app.get('/release/{}'.format(r1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
# delete creator
eg = quick_eg(api)
api.delete_creator(c1.ident, editgroup_id=eg.editgroup_id)
api.accept_editgroup(eg.editgroup_id)
rv = app.get('/creator/{}'.format(c1.ident))
- assert rv.status_code == 200 # TODO: HTTP status "Gone"?
+ # TODO: HTTP status "Gone"?
+ rv.raise_for_status()
c1_deleted = api.get_creator(c1.ident)
assert c1_deleted.state == "deleted"
@@ -77,7 +78,7 @@ def test_relation_states(api, app):
assert r1.contribs[0].creator.display_name is None
assert r1.contribs[0].creator.state == "deleted"
rv = app.get('/release/{}'.format(r1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
# wip container
eg = quick_eg(api)
@@ -94,7 +95,7 @@ def test_relation_states(api, app):
assert r1.contribs[0].creator.display_name is None
assert r1.contribs[0].creator.state == "deleted"
rv = app.get('/release/{}'.format(r1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
# redirect release
r2 = api.get_release(r2.ident, expand="container,creators,files")
@@ -116,7 +117,7 @@ def test_relation_states(api, app):
rv = app.get('/release/{}'.format(r2.ident))
assert rv.status_code == 302
rv = app.get('/file/{}'.format(f2.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
# delete release
eg = quick_eg(api)
@@ -128,10 +129,11 @@ def test_relation_states(api, app):
assert r2.files is None
assert r2.contribs is None
rv = app.get('/release/{}'.format(r2.ident))
- assert rv.status_code == 200 # TODO: HTTP Gone?
+ # TODO: HTTP Gone?
+ rv.raise_for_status()
rv = app.get('/file/{}'.format(f2.ident))
print(rv.data)
- assert rv.status_code == 200
+ rv.raise_for_status()
def test_app_entity_states(api, app):
@@ -171,23 +173,23 @@ def test_app_entity_states(api, app):
# all entities
rv = app.get('/container/{}'.format(j1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/{}'.format(j2.ident))
assert rv.status_code == 302
rv = app.get('/creator/{}'.format(c1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/creator/{}'.format(c2.ident))
assert rv.status_code == 302
rv = app.get('/file/{}'.format(f1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/file/{}'.format(f2.ident))
assert rv.status_code == 302
rv = app.get('/release/{}'.format(r1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/{}'.format(r2.ident))
assert rv.status_code == 302
rv = app.get('/work/{}'.format(r1.work_id))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/{}'.format(r2.work_id))
assert rv.status_code == 302
@@ -202,23 +204,23 @@ def test_app_entity_states(api, app):
# all entities
rv = app.get('/container/{}'.format(j1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/container/{}'.format(j2.ident))
assert rv.status_code == 302
rv = app.get('/creator/{}'.format(c1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/creator/{}'.format(c2.ident))
assert rv.status_code == 302
rv = app.get('/file/{}'.format(f1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/file/{}'.format(f2.ident))
assert rv.status_code == 302
rv = app.get('/release/{}'.format(r1.ident))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/release/{}'.format(r2.ident))
assert rv.status_code == 302
rv = app.get('/work/{}'.format(r1.work_id))
- assert rv.status_code == 200
+ rv.raise_for_status()
rv = app.get('/work/{}'.format(r2.work_id))
assert rv.status_code == 302