aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-16 18:34:19 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-16 18:34:19 -0700
commit4cf667c283d54f769e73d76bb23bbb68b4329cf8 (patch)
tree4bbeb1cdeb053c09e86e2cc41962382bcb837729 /python/tests/routes.py
parentb2d5968e0a7ac5576782f54980c930345f4c5298 (diff)
downloadfatcat-4cf667c283d54f769e73d76bb23bbb68b4329cf8.tar.gz
fatcat-4cf667c283d54f769e73d76bb23bbb68b4329cf8.zip
move python code to subdirectory
Diffstat (limited to 'python/tests/routes.py')
-rw-r--r--python/tests/routes.py67
1 files changed, 67 insertions, 0 deletions
diff --git a/python/tests/routes.py b/python/tests/routes.py
new file mode 100644
index 00000000..79d97fe4
--- /dev/null
+++ b/python/tests/routes.py
@@ -0,0 +1,67 @@
+
+import json
+import tempfile
+import pytest
+import fatcat
+import fatcat.sql
+from fatcat.models import *
+from fixtures import *
+
+
+def test_static_routes(rich_app):
+ app = rich_app
+
+ for route in ('/health', '/robots.txt', '/', '/about'):
+ rv = app.get(route)
+ assert rv.status_code == 200
+
+ assert app.get("/static/bogus/route").status_code == 404
+
+
+def test_all_views(rich_app):
+ app = rich_app
+
+ for route in ('work', 'release', 'creator', 'container', 'file'):
+ print(route)
+ rv = app.get('/{}/1'.format(route))
+ assert rv.status_code == 200
+
+ rv = app.get('/{}/999999999999'.format(route))
+ assert rv.status_code == 404
+
+ rv = app.get('/work/random')
+ rv = app.get(rv.location)
+ assert rv.status_code == 200
+
+ rv = app.get('/work/random')
+ assert rv.status_code == 302
+
+ rv = app.get('/work/create')
+ assert rv.status_code == 200
+
+ rv = app.get('/release/random')
+ assert rv.status_code == 302
+
+ rv = app.get('/release/1/changelog')
+ assert rv.status_code == 200
+
+ rv = app.get('/editgroup/1')
+ assert rv.status_code == 200
+
+ rv = app.get('/editgroup/99999999')
+ assert rv.status_code == 404
+
+ rv = app.get('/editgroup/current')
+ assert rv.status_code == 302
+
+ rv = app.get('/editor/admin')
+ assert rv.status_code == 200
+
+ rv = app.get('/editor/bizzaro')
+ assert rv.status_code == 404
+
+ rv = app.get('/editor/admin/changelog')
+ assert rv.status_code == 200
+
+ rv = app.get('/editor/bizarro/changelog')
+ assert rv.status_code == 404