-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
34 lines (26 loc) · 1.21 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
__author__ = 'Christophe Bastin'
from django.test import TestCase
from django.test import Client
class ParcInfoTestCase(TestCase):
fixtures = ['fixtures']
def setUp(self):
self.client = Client()
def testAdmin(self):
self.client.login(username='admin', password='admin')
response = self.client.post('/admin', follow=True)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'admin/index.html')
def testAdminAnonymous(self):
response = self.client.post('/admin', follow=True)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'admin/login.html')
def testAdminNotAuthorized(self):
self.client.login(username='test', password='test')
response = self.client.post('/admin', follow=True)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'admin/login.html')
def testAdminParcInfo(self):
self.client.login(username='admin', password='admin')
response = self.client.post('/admin/parcInfo', follow=True)
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'admin/app_index.html')