From 69b3f93224e0651ecd20976420e47dc4299f9dcf Mon Sep 17 00:00:00 2001
From: Grigi <nagrigoriadis@gmail.com>
Date: Wed, 19 Nov 2014 15:16:20 +0200
Subject: [PATCH] Added tox as a test-runner, it will build different
 virtualenvs for each target. getlasso.sh is very hacky and should probably be
 changed.

---
 .gitignore       |  4 +++-
 MANIFEST.in      |  2 ++
 getlasso.sh      |  5 +++++
 requirements.txt |  2 +-
 setup.py         |  2 +-
 test_settings    | 34 ++++++++++++++++++++++++++++++++++
 tox.ini          | 25 +++++++++++++++++++++++++
 7 files changed, 71 insertions(+), 3 deletions(-)
 create mode 100755 getlasso.sh
 create mode 100644 test_settings
 create mode 100644 tox.ini

diff --git a/.gitignore b/.gitignore
index 27c6770..2487d74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,6 @@ log.log
 authentic2/locale/fr/LC_MESSAGES/django.mo
 local_settings.*
 *.egg-info
-*.mo
\ No newline at end of file
+*.mo
+.tox
+
diff --git a/MANIFEST.in b/MANIFEST.in
index 91e493f..8d0f4b9 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -44,6 +44,8 @@ include diagnose.py
 include ez_setup.py
 include authentic2/auth2_auth/auth2_ssl/authentic_ssl.vhost
 include requirements.txt
+include test_settings
+include getlasso.sh
 include authentic2/vendor/dpam/LICENSE
 include authentic2/nonce/README.rst
 include doc/conf.py doc/Makefile doc/README.rst.bak 
diff --git a/getlasso.sh b/getlasso.sh
new file mode 100755
index 0000000..e6c646f
--- /dev/null
+++ b/getlasso.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+ln -s /usr/lib64/python2.7/site-packages/lasso.py `python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'` 2>/dev/null
+ln -s /usr/lib64/python2.7/site-packages/_lasso.* `python -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())'` 2>/dev/null
+exit 0
+
diff --git a/requirements.txt b/requirements.txt
index 1f322bc..039de46 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,4 @@
-Django<1.6
+Django>1.5,<1.7
 south>=0.8.4
 requests
 django-model-utils
diff --git a/setup.py b/setup.py
index 56f3a28..349e59f 100755
--- a/setup.py
+++ b/setup.py
@@ -113,7 +113,7 @@ setup(name="authentic2",
       scripts = ('authentic2-ctl',),
       packages=find_packages(),
       include_package_data=True,
-      install_requires=['django < 1.6',
+      install_requires=['django >= 1.5, < 1.7',
         'south>=0.8.4',
         'requests',
         'django-model-utils',
diff --git a/test_settings b/test_settings
new file mode 100644
index 0000000..101830c
--- /dev/null
+++ b/test_settings
@@ -0,0 +1,34 @@
+import os.path
+
+DEBUG = False
+
+if DEBUG:
+	DEBUG_TOOLBAR = True
+	TEMPLATE_DEBUG = True
+	DEBUG_TOOLBAR_CONFIG = {
+			'INTERCEPT_REDIRECTS': False,
+	}
+INTERNAL_IPS = ('127.0.0.1',)
+
+SECRET_KEY = 'coin'
+
+from authentic2.settings import INSTALLED_APPS, \
+     MIDDLEWARE_CLASSES
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(os.path.dirname(__file__), 'authentic2.sqlite'),
+    },
+}
+
+if DEBUG:
+	INSTALLED_APPS += ('debug_toolbar',)
+	MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
+
+
+LANGUAGE_CODE = 'en'
+
+IDP_SAML2 = True
+#IDP_OPENID = True
+
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..e7cc245
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,25 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = django15, django16
+
+[testenv:django15]
+commands =
+    ./getlasso.sh
+    ln -sf test_settings local_settings.py
+    ./authentic2-ctl test auth contenttypes sessions messages admin_tools theming menu dashboard authentic2
+deps = django>1.5,<1.6
+
+[testenv:django16]
+commands =
+    ./getlasso.sh
+    ln -sf test_settings local_settings.py
+    ./authentic2-ctl test django.contrib.auth django.contrib.contenttypes django.contrib.sessions django.contrib.messages admin_tools authentic2
+deps = django>1.6,<1.7
+
+
+
+
-- 
2.0.4

