Commits

Peter Sagerson  committed cde3857

A more convenient test harness.

  • Participants
  • Parent commits 7b8f8c4

Comments (0)

Files changed (7)

File test/django_auth_ldap

+../django_auth_ldap

File test/manage.py

+#!/usr/bin/env python
+
+import os
+import sys
+
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)

File test/test/__init__.py

Empty file added.

File test/test/settings.py

+# For older versions of Djano
+DATABASE_ENGINE = 'sqlite3'
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': '',                      # Or path to database file if using sqlite3.
+        # The following settings are not used with sqlite3:
+        'USER': '',
+        'PASSWORD': '',
+        'HOST': '',                      # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
+        'PORT': '',                      # Set to empty string for default.
+    }
+}
+
+ALLOWED_HOSTS = []
+
+TIME_ZONE = 'UTC'
+LANGUAGE_CODE = 'en-us'
+USE_I18N = False
+USE_L10N = False
+USE_TZ = True
+
+SECRET_KEY = 'nt56v8)moa)37ta5z7dd=if-@y#k@l7+t8lct*c8m730lpd=so'
+
+ROOT_URLCONF = 'tests.urls'
+WSGI_APPLICATION = 'tests.wsgi.application'
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+
+    'django_auth_ldap',
+)

File test/test/urls.py

+from django.conf.urls import patterns
+
+
+urlpatterns = patterns('')

File test/test/wsgi.py

+"""
+WSGI config for tests project.
+
+This module contains the WSGI application used by Django's development server
+and any production WSGI deployments. It should expose a module-level variable
+named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
+this application via the ``WSGI_APPLICATION`` setting.
+
+Usually you will have the standard Django WSGI application here, but it also
+might make sense to replace the whole Django WSGI application with a custom one
+that later delegates to the Django one. For example, you could introduce WSGI
+middleware here, or combine a Django application with an application of another
+framework.
+
+"""
+import os
+
+# We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks
+# if running multiple sites in the same mod_wsgi process. To fix this, use
+# mod_wsgi daemon mode with each site in its own daemon process, or use
+# os.environ["DJANGO_SETTINGS_MODULE"] = "tests.settings"
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test.settings")
+
+# This application object is used by any WSGI server configured to use this
+# file. This includes Django's development server, if the WSGI_APPLICATION
+# setting points here.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
+
+# Apply WSGI middleware here.
+# from helloworld.wsgi import HelloWorldApplication
+# application = HelloWorldApplication(application)

File test/testin.sh

+#!/bin/sh
+
+# A handy script for testing in multiple virtualenvs. Mine are set to the
+# default, but others can be passed as arguments.
+
+if [ "$#" = "0" ]; then
+    virtualenvs=`for x in 1 2 3 4 5; do echo "${HOME}/.virtualenvs/django-1.${x} "; done`
+else
+    virtualenvs="$*"
+fi
+
+
+for venv in ${virtualenvs}; do
+    echo ${venv}
+    source ${venv}/bin/activate
+    python manage.py test django_auth_ldap
+    deactivate
+done