Added tests for markdown base template
This commit is contained in:
parent
31c19236ac
commit
d4c975deda
3 changed files with 26 additions and 2 deletions
|
@ -1,6 +1,8 @@
|
|||
from django.test import TestCase
|
||||
from django.core.urlresolvers import reverse
|
||||
import os.path
|
||||
|
||||
PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
class CustomTemplateTestCase(TestCase):
|
||||
def setUp(self):
|
||||
|
@ -26,3 +28,21 @@ class ReverserTestCase(TestCase):
|
|||
def test_invalid_reverser(self):
|
||||
response = self.client.post(reverse(self.REVERSER_IDENT), data={'ident': 'pages:i-dont-exist'})
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
|
||||
class MarkdownViewTestCase(TestCase):
|
||||
def test_accessable(self):
|
||||
response = self.client.get(reverse('pages:projects', args=['test']))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_parsing(self):
|
||||
response = self.client.get(reverse('pages:projects', args=['test']))
|
||||
self.assertContains(response, '<h1>Testing</h1>')
|
||||
|
||||
def test_template_engine(self):
|
||||
response = self.client.get(reverse('pages:projects', args=['test']))
|
||||
self.assertContains(response, reverse('pages:all-projects'))
|
||||
|
||||
def test_invalid_template(self):
|
||||
response = self.client.get(reverse('pages:projects', args=['not-a-project']))
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.views.generic import TemplateView, FormView
|
||||
from django.template import loader, Context, TemplateDoesNotExist
|
||||
from django.template import loader, Context
|
||||
from django.template.base import TemplateDoesNotExist
|
||||
from django.http import Http404
|
||||
import markdown2
|
||||
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
# Test!
|
||||
# Testing
|
||||
This page is for testing only.
|
||||
|
||||
Please [check out my other projects]({% url 'pages:all-projects' %}).
|
||||
|
|
Reference in a new issue