realms-wiki/realms/modules/wiki/tests.py

39 lines
1.3 KiB
Python
Raw Normal View History

from nose.tools import *
from flask import url_for
from realms.modules.wiki.models import Wiki, cname_to_filename, filename_to_cname
2014-10-22 00:06:27 +03:00
from realms.lib.test import BaseTest
2014-10-22 00:06:27 +03:00
class WikiTest(BaseTest):
def test_wiki_routes(self):
self.assert_200(self.client.get(url_for("wiki.create")))
2014-10-17 00:54:45 +03:00
""" Create a test page first!
for route in ['page', 'edit', 'history', 'index']:
rv = self.client.get(url_for("wiki.%s" % route, name='test'))
self.assert_200(rv, "wiki.%s: %s" % (route, rv.status_code))
2014-10-17 00:54:45 +03:00
"""
def test_write_page(self):
2014-10-22 00:06:27 +03:00
self.assert_200(
self.client.post(url_for('wiki.page_write', name='test'), data=dict(
content='testing',
message='test message'
)))
self.assert_200(self.client.get(url_for('wiki.page', name='test')))
def test_delete_page(self):
self.assert_200(self.client.delete(url_for('wiki.page_write', name='test')))
self.assert_status(self.client.get(url_for('wiki.page', name='test')), 302)
def test_revert(self):
pass
def test_cname_to_filename(self):
eq_(cname_to_filename('test'), 'test.md')
def test_filename_to_cname(self):
eq_(filename_to_cname('test-1-2-3.md'), 'test-1-2-3')