added tests for admin changelist

This commit is contained in:
Ales Zoulek 2010-11-12 15:06:59 +01:00
parent d1a88854a3
commit 1354913997
2 changed files with 28 additions and 1 deletions

View file

@ -10,10 +10,18 @@ DATABASES = {
}
INSTALLED_APPS = (
'tests',
'django.contrib.sessions',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.admin',
'constance',
'tests',
)
ROOT_URLCONF = 'tests.test_urls'
CONSTANCE_CONNECTION_CLASS = 'tests.redis_mockup.Connection'
CONSTANCE_CONFIG = {

View file

@ -5,8 +5,14 @@ from decimal import Decimal
from django.test import TestCase
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.models import User
from constance import config
from constance.admin import Config
# Use django RequestFactory later on
from helpers import FakeRequest
@ -66,3 +72,16 @@ class TestStorage(TestCase):
self.assertEquals(type(e), AttributeError)
class TestAdmin(TestCase):
urls = 'tests.tests'
model = Config
def setUp(self):
self.user = User.objects.create_superuser('admin', 'nimda', 'a@a.cz')
self.options = admin.site._registry[self.model]
self.fake_request = FakeRequest(user=self.user)
self.client.login(username=self.user, password='nimda')
def test_changelist(self):
self.assertEquals(self.options.changelist_view(self.fake_request, {}), {})