-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.py
executable file
·34 lines (27 loc) · 1.02 KB
/
tests.py
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
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
"""
import django
from django.test import TestCase
# TODO: Configure your database in settings.py and sync before running tests.
class ViewTest(TestCase):
"""Tests for the application views."""
if django.VERSION[:2] >= (1, 7):
# Django 1.7 requires an explicit setup() when running tests in PTVS
@classmethod
def setUpClass(cls):
super(ViewTest, cls).setUpClass()
django.setup()
def test_home(self):
"""Tests the home page."""
response = self.client.get('/')
self.assertContains(response, 'Home Page', 1, 200)
def test_contact(self):
"""Tests the contact page."""
response = self.client.get('/contact')
self.assertContains(response, 'Contact', 3, 200)
def test_about(self):
"""Tests the about page."""
response = self.client.get('/about')
self.assertContains(response, 'About', 3, 200)