Commit a07bd2b0 authored by Daniel Schreiber's avatar Daniel Schreiber

also test admin view

parent a35a8223
import django
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
......@@ -5,11 +7,12 @@ CACHES = {
}
DATABASES = {
'default': {'ENGINE': 'django.db.backends.sqlite3'}
'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3'}
}
INSTALLED_APPS = [
'tuc2014',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
......@@ -18,10 +21,21 @@ INSTALLED_APPS = [
'tests',
]
#DEBUG=True
ROOT_URLCONF = 'tests.urls'
SECRET_KEY = 'fake-key'
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
if django.VERSION < (1, 10, 0):
MIDDLEWARE_CLASSES = MIDDLEWARE
TEMPLATES = [
{
......@@ -29,6 +43,13 @@ TEMPLATES = [
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
]
},
},
]
\ No newline at end of file
]
STATIC_URL = '/static/'
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.test import Client, TestCase
from django.utils import six
......@@ -15,3 +16,11 @@ class Tuc2014TestCase(TestCase):
self.assertEquals(response.status_code, 200)
self.assertTrue(self.CONTENT_BLOCK in six.text_type(response.content, "utf-8"))
def test_admin(self):
user = User.objects.create_superuser(username="test", email="", password="test")
user.set_password("test")
user.save()
self.client.login(username="test", password="test")
response = self.client.get('/admin/')
self.assertEquals(response.status_code, 200)
from django.conf.urls import url
from django.contrib import admin
from .views import index
urlpatterns = [
url(r'^$', index),
url('admin/', admin.site.urls),
]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment