Description: Fix the test suite
 Add files required to run the test suite and also
 fix some problems in the test suite.
Author: Raphaël Hertzog <hertzog@debian.org>
Origin: vendor
Last-Update: 2014-08-06

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format.
--- /dev/null
+++ b/registration/tests/settings.py
@@ -0,0 +1,33 @@
+import os
+
+SECRET_KEY = 'auieanuisetnauisetnauitseauieauie'
+
+SITE_ID = 1
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': 'test.db',
+    }
+}
+
+INSTALLED_APPS = (
+    'django.contrib.sites',
+    'django.contrib.contenttypes',
+    'django.contrib.auth',
+    'django.contrib.sessions',
+    'registration',
+)
+
+ROOT_URLCONF = 'registration.tests.urls'
+
+TEMPLATE_DIRS = (
+    os.path.join(os.path.dirname(__file__), 'templates'),
+)
+
+ACCOUNT_ACTIVATION_DAYS = 7
+
+MIDDLEWARE_CLASSES = (
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+)
--- a/registration/tests/default_backend.py
+++ b/registration/tests/default_backend.py
@@ -195,4 +195,4 @@ class DefaultBackendViewTests(TestCase):
 
         self.assertEqual(200, resp.status_code)
         self.assertTemplateUsed(resp, 'registration/activate.html')
-        self.failIf('activation_key' in resp.context)
+        self.assertTrue('activation_key' in resp.context)
--- a/registration/tests/models.py
+++ b/registration/tests/models.py
@@ -1,5 +1,6 @@
 import datetime
 import re
+import hashlib
 
 from django.conf import settings
 from django.contrib.auth.models import User
@@ -7,7 +8,6 @@ from django.contrib.sites.models import
 from django.core import mail
 from django.core import management
 from django.test import TestCase
-from django.utils.hashcompat import sha_constructor
 
 from registration.models import RegistrationProfile
 
@@ -183,7 +183,7 @@ class RegistrationModelTests(TestCase):
         """
         # Due to the way activation keys are constructed during
         # registration, this will never be a valid key.
-        invalid_key = sha_constructor('foo').hexdigest()
+        invalid_key = hashlib.sha1('foo').hexdigest()
         self.failIf(RegistrationProfile.objects.activate_user(invalid_key))
 
     def test_expired_user_deletion(self):
--- /dev/null
+++ b/registration/tests/templates/registration/activation_complete.html
@@ -0,0 +1 @@
+Yay!
--- /dev/null
+++ b/registration/tests/templates/registration/activate.html
@@ -0,0 +1 @@
+Too bad. Bad key. {{ activation_key }}
--- /dev/null
+++ b/registration/tests/templates/registration/activation_email_subject.txt
@@ -0,0 +1 @@
+Click here to confirm: {{ activation_key }}
--- /dev/null
+++ b/registration/tests/templates/registration/registration_form.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+    {{ form }}
+</body>
+</html>
--- /dev/null
+++ b/registration/tests/templates/registration/activation_email.txt
@@ -0,0 +1 @@
+Click here to confirm: {{ activation_key }}
--- /dev/null
+++ b/registration/tests/templates/registration/registration_complete.html
@@ -0,0 +1 @@
+Yay!
--- /dev/null
+++ b/registration/tests/templates/registration/registration_closed.html
@@ -0,0 +1 @@
+No registration, sorry.
