Skip to content
Browse files

Prepared to move tests into an independent directory.

  • Loading branch information...
1 parent 1c85f17 commit 5b9bcccd4e7416f2a2e36097deb08c522395c405 @zsiciarz committed Jun 2, 2011
Showing with 76 additions and 2 deletions.
  1. +0 −2 example_project/settings.py
  2. +11 −0 runtests.py
  3. 0 tests/__init__.py
  4. +28 −0 tests/templates/layout.html
  5. +37 −0 tests/test_settings.py
View
2 example_project/settings.py
@@ -107,7 +107,5 @@ def project_path(path):
'honeypot',
)
-TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
-
HONEYPOT_FIELD_NAME = 'email2'
View
11 runtests.py
@@ -0,0 +1,11 @@
+import os
+import sys
+
+sys.path.insert(0, os.path.abspath('.'))
+os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.test_settings'
+
+from django.conf import settings
+from django.core.management import call_command
+
+call_command('test', 'envelope')
+
View
0 tests/__init__.py
No changes.
View
28 tests/templates/layout.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Contact me!</title>
+</head>
+
+<body>
+ <div>
+ <header>
+ <h1>Contact me!</h1>
+ <ul class="messages">
+ {% for message in messages %}
+ <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
+ {% endfor %}
+ </ul>
+ </header>
+
+ <div>
+ {% block content %}{% endblock %}
+ </div>
+
+ <footer>
+ <p>&copy; Copyright 2011 Zbigniew Siciarz.</p>
+ </footer>
+ </div>
+</body>
+</html>
View
37 tests/test_settings.py
@@ -0,0 +1,37 @@
+# Minimal settings module required for running django-envelope's unit tests.
+
+import os
+
+
+def make_absolute_path(path):
+ return os.path.join(os.path.realpath(os.path.dirname(__file__)), path)
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': ':memory:',
+ }
+}
+
+INSTALLED_APPS = (
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+ 'django_nose',
+ 'envelope',
+ 'honeypot',
+)
+
+TEMPLATE_DIRS = (
+ make_absolute_path('templates'),
+)
+
+ROOT_URLCONF = 'example_project.urls'
+
+TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
+NOSE_ARGS = ['--stop']
+
+HONEYPOT_FIELD_NAME = 'email2'
+

0 comments on commit 5b9bccc

Please sign in to comment.
Something went wrong with that request. Please try again.