From 1c36fb0e0c145d8cd43268961244dbed6a64b40f Mon Sep 17 00:00:00 2001 From: Nik Nyby Date: Wed, 4 Mar 2015 13:55:14 -0500 Subject: [PATCH] Make the tests passing again Made some django 1.7 fixes and fixture corrections --- tests/__init__.py | 7 + tests/fixtures/basic.html | 249 +++++++++------------------------ tests/fixtures/horizontal.html | 242 +++++++++----------------------- tests/test_settings.py | 6 + 4 files changed, 149 insertions(+), 355 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index aadc141..468ab11 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -8,6 +8,7 @@ parent = os.path.dirname(os.path.dirname( sys.path.insert(0, parent) +import django from django.test import TestCase from django.template import Template, Context from django.core.management import call_command @@ -23,6 +24,12 @@ CHOICES = ( (2, 'Two'), ) +try: + # required by Django 1.7 and later + django.setup() +except: + pass + class ExampleForm(forms.Form): char_field = forms.CharField() choice_field = forms.ChoiceField(choices=CHOICES) diff --git a/tests/fixtures/basic.html b/tests/fixtures/basic.html index 322806e..d316ca5 100644 --- a/tests/fixtures/basic.html +++ b/tests/fixtures/basic.html @@ -1,210 +1,99 @@ - - - - - - -
- - - - - -
- - - - - -
- + +
+ +
- - -
- - - - - -
- - - - - -
- + +
+ +
- - -
- - - - -
- -
- -
- -
- -
- -
- -
- - - - - + +
+
+
- + +
+ +
+ +
+ +
+
- - -
- - - - - -
- - - - - -
- + +
+ +
- - -
- - - - - -
-
    -
  • -
  • -
  • -
- - - - -
- + +
+
    +
  • +
  • +
  • +
+
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
- - - - - -
- - - - - -
- + +
+ +
- - -
- -
-
- - - - - - -
+
+
+
- +
- - diff --git a/tests/fixtures/horizontal.html b/tests/fixtures/horizontal.html index b255d51..5634218 100644 --- a/tests/fixtures/horizontal.html +++ b/tests/fixtures/horizontal.html @@ -1,210 +1,102 @@ - - - - - - -
+ - - - - -
- - - - - -
- +
+ +
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
+ - - - -
- -
- -
- -
- -
- -
- -
- - - - - +
+
+
- +
+ +
+
+ +
+
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
- - - - - -
-
    -
  • -
  • -
  • -
- - - - -
- + +
+
    +
  • +
  • +
  • +
+
- - -
+ - - - - -
- - - - - -
- +
+ +
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
- - - - + -
- - - - - -
- +
+ +
- - -
- -
-
- - - - - - -
+
+
+
- +
- - diff --git a/tests/test_settings.py b/tests/test_settings.py index 14d0ca0..2d5ccf9 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -10,6 +10,12 @@ DATABASES = { SITE_ID = 1 +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +) + INSTALLED_APPS = [ 'django.contrib.contenttypes', 'django.contrib.sites',