mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
added tests for admin changelist
This commit is contained in:
parent
d1a88854a3
commit
1354913997
2 changed files with 28 additions and 1 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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, {}), {})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue