aboutsummaryrefslogtreecommitdiffstats
path: root/app_test.py
diff options
context:
space:
mode:
authorGravatar Joseph <[email protected]>2018-04-17 23:12:35 +0100
committerGravatar GitHub <[email protected]>2018-04-17 23:12:35 +0100
commitc99f816e71d28dfaf3bd44d27d211f2b44778f48 (patch)
tree297747765dfcd5163839333c0879e04e2e4b565b /app_test.py
parentJSON file had the wrong name. I should be incarcerated. (diff)
Add wiki audit logs (#52)
* Add wiki audit logs * Flake8 issues * Forgot to remove debug prints * Removed print but forgot to remove `.text` * Futile attempt to increase coverage * Reading up on API docs asks us to send User-Agent with our info in it * Add tests for wiki * Well played, Travis * Nothing in my local env is working on travis lol * Why does it appear it can't decide between 200 & 302 :thinking: * Flake8 * Post route * Same issue with local env working differently from Travis env * Add page to show page is being edited * Lock page when it is being edited * Add JS to keep refreshing lock on article * Add compare route to render diff * Add revision table to database * Add revision storage * Add revision list route * JS for Revision list radio buttons * Add revision comparison template * Add revision list template * flak8 my ass * [Unit Tests] New unit tests for history routes :sparkles: * Does this fix things? * Address gdude's reviews * Noticed a bug in the diff generation route which meant that empty posts could potentially error * Flake 8 * Audit logs were logging after change, meaning it was comparing after & after, which didn't work * Change table name * Remove whitespace from line to fix flake8 issue * Address reviews * Git hook made me do something wrong, apologies * Switch from werkzeug redirect to flask one * Address Apertures reviews
Diffstat (limited to 'app_test.py')
-rw-r--r--app_test.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/app_test.py b/app_test.py
index 1e46a73d..20293db9 100644
--- a/app_test.py
+++ b/app_test.py
@@ -114,6 +114,26 @@ class RootEndpoint(SiteTest):
response = self.client.get("/500")
self.assertEqual(response.status_code, 500)
+ def test_wiki_edit(self):
+ """Test that the wiki edit page redirects to login"""
+ response = self.client.get("/edit/page", "http://wiki.pytest.local")
+ self.assertEqual(response.status_code, 302)
+
+ def test_wiki_edit_post_empty_request(self):
+ """Empty request should redirect to login"""
+ response = self.client.post("/edit/page", "http://wiki.pytest.local")
+ self.assertEqual(response.status_code, 302)
+
+ def test_wiki_history(self):
+ """Test the history show"""
+ response = self.client.get("/history/show/blahblah-non-existant-page", "http://wiki.pytest.local")
+ self.assertEqual(response.status_code, 404) # Test that unknown routes 404
+
+ def test_wiki_diff(self):
+ """Test whether invalid revision IDs error"""
+ response = self.client.get("/history/compare/ABC/XYZ", "http://wiki.pytest.local")
+ self.assertEqual(response.status_code, 404) # Test that unknown revisions 404
+
class ApiEndpoints(SiteTest):
""" Test cases for the api subdomain """
@@ -236,7 +256,6 @@ class StaffEndpoints(SiteTest):
from pysite.views.staff.index import StaffView
sv = StaffView()
result = sv.get()
- print(repr(result.data))
self.assertEqual(result.status_code, 302) # TODO: Do this correctly
response = self.client.get('/', app.config['STAFF_SUBDOMAIN'])