aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_wiki.py
blob: e16152a14200328b1849a64014ff5e599fbc1ecc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from tests import SiteTest, app

class WikiEndpoints(SiteTest):
    """ Test cases for the wiki subdomain """
    def test_wiki_edit(self):
        """Test that the wiki edit page redirects to login"""
        response = self.client.get("/edit/page", app.config['WIKI_SUBDOMAIN'])
        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", app.config['WIKI_SUBDOMAIN'])
        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", app.config['WIKI_SUBDOMAIN'])
        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", app.config['WIKI_SUBDOMAIN'])
        self.assertEqual(response.status_code, 404) # Test that unknown revisions 404

    def test_wiki_special(self):
        """Test whether invalid revision IDs error"""
        response = self.client.get("/special", app.config['WIKI_SUBDOMAIN'])
        self.assertEqual(response.status_code, 200)

    def test_wiki_special_all_pages(self):
        """Test whether invalid revision IDs error"""
        response = self.client.get("/special/all_pages", app.config['WIKI_SUBDOMAIN'])
        self.assertEqual(response.status_code, 200)