mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-04-20 06:41:06 +00:00
Added tests for example2 admin index.
This commit is contained in:
parent
d2d65bdb3f
commit
25a9d72322
3 changed files with 23 additions and 16 deletions
|
|
@ -1,16 +0,0 @@
|
|||
"""
|
||||
This file demonstrates writing tests using the unittest module. These will pass
|
||||
when you run "manage.py test".
|
||||
|
||||
Replace this with more appropriate tests for your application.
|
||||
"""
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
class SimpleTest(TestCase):
|
||||
def test_basic_addition(self):
|
||||
"""
|
||||
Tests that 1 + 1 always equals 2.
|
||||
"""
|
||||
self.assertEqual(1 + 1, 2)
|
||||
1
example2/polls/tests/__init__.py
Normal file
1
example2/polls/tests/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from test_views import *
|
||||
22
example2/polls/tests/test_views.py
Normal file
22
example2/polls/tests/test_views.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase, Client
|
||||
|
||||
|
||||
class BaseIntegrationTest(TestCase):
|
||||
"""
|
||||
Base TestCase for integration tests.
|
||||
"""
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
self.user = get_user_model()(username='user', is_staff=True,
|
||||
is_superuser=True)
|
||||
self.user.set_password("password")
|
||||
self.user.save()
|
||||
self.client.login(username='user', password='password')
|
||||
|
||||
|
||||
class AdminIndexTest(BaseIntegrationTest):
|
||||
def test_view_ok(self):
|
||||
response = self.client.get(reverse("admin2:dashboard"))
|
||||
self.assertContains(response, reverse("admin2:polls_poll_index"))
|
||||
Loading…
Reference in a new issue