fix
[fnpdjango.git] / runtests.py
index 3f8dd95..c5b392f 100644 (file)
@@ -1,13 +1,10 @@
 #!/usr/bin/env python
-# -*- coding: utf-8
 # This file is part of FNPDjango, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
 #
 """
 Creates a simple Django configuration and runs tests for fnpdjango.
 """
-from __future__ import unicode_literals
-
 import sys
 import os
 from os.path import dirname, abspath
@@ -28,42 +25,61 @@ if not settings.configured and not os.environ.get('DJANGO_SETTINGS_MODULE'):
         DATABASES={
             'default': {
                 'ENGINE': 'django.db.backends.sqlite3',
+
+                'NAME': 'test.db',
             }
         },
         INSTALLED_APPS=[
+            'django.contrib.admin',
             'django.contrib.auth',
             'django.contrib.contenttypes',
+            'django.contrib.messages',
             'django.contrib.sessions',
             'django.contrib.sites',
+            'django.contrib.staticfiles',
 
             'fnpdjango',
             'tests',
         ],
         LANGUAGE_CODE='pl',
         MEDIA_ROOT=media_root,
-        MIDDLEWARE_CLASSES=[
+        STATIC_URL='/static/',
+        STATIC_ROOT='./static/',
+        STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineManifestStorage',
+        MIDDLEWARE=[
             'django.middleware.common.CommonMiddleware',
-            'fnpdjango.middleware.URLLocaleMiddleware',
             'fnpdjango.middleware.SetRemoteAddrFromXRealIP',
+            'django.contrib.sessions.middleware.SessionMiddleware',
+            'django.contrib.auth.middleware.AuthenticationMiddleware',
+            'django.contrib.messages.middleware.MessageMiddleware',
         ],
         FNPDJANGO_REALIP = True,
         ROOT_URLCONF='tests.urls',
         TEMPLATES=[
             {
                 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+                'APP_DIRS': True,
+                'OPTIONS': {
+                    'context_processors': [
+                        'django.contrib.auth.context_processors.auth',
+                        'django.contrib.messages.context_processors.messages',
+                    ]
+                }
             },
         ],
         TEST_LAZY_UGETTEXT_LAZY=_("Lazy setting."),
         USE_I18N=True,
+
+        SECRET_KEY='x',
+        DEBUG=True,
+        SITE_ID=1,
+
+        PIPELINE={}
     )
 else:
     media_root = None
 
-try:
-    from django.test.runner import DiscoverRunner
-except ImportError:
-    # Django < 1.6
-    from django.test.simple import DjangoTestSuiteRunner as DiscoverRunner
+from django.test.runner import DiscoverRunner
 
 
 def runtests(*test_args, **kwargs):
@@ -73,13 +89,8 @@ def runtests(*test_args, **kwargs):
     parent = dirname(abspath(__file__))
     sys.path.insert(0, parent)
 
-    # For Django 1.7+
-    try:
-        from django import setup
-    except ImportError:
-        pass
-    else:
-        setup()
+    from django import setup
+    setup()
 
     test_runner = DiscoverRunner(
         verbosity=kwargs.get('verbosity', 1),