Permalink
Browse files

Add support for running tests via fabric.

  • Loading branch information...
1 parent 84156b3 commit 0a8cad64c2e63e010f1a37badd1546240f51fd8d @Osmose committed Mar 14, 2012
Showing with 60 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +6 −0 README.rst
  3. +24 −0 django_browserid/tests/settings.py
  4. +5 −0 django_browserid/tests/urls.py
  5. +3 −2 django_browserid/urls.py
  6. +19 −0 fabfile.py
  7. +2 −1 requirements.txt
View
@@ -1 +1,2 @@
*.pyc
+test.db
View
@@ -193,6 +193,12 @@ optional config in ``settings.py`` (they have sensible defaults): ::
# Disable SSL cert validation
BROWSERID_DISABLE_CERT_CHECK = False
+Testing
+-------
+0. (Recommended) Create a virtualenv for django-browserid testing.
+1. Install test requirements with ``pip install -r requirements.txt``
+2. Run test suite with ``fab test``
+
License
-------
@@ -0,0 +1,24 @@
+TEST_RUNNER = 'django_nose.runner.NoseTestSuiteRunner'
+
+DATABASES = {
+ 'default': {
+ 'NAME': 'test.db',
+ 'ENGINE': 'django.db.backends.sqlite3',
+ }
+}
+
+INSTALLED_APPS = (
+ 'django_nose',
+ 'django_browserid',
+
+ 'django.contrib.auth',
+ 'django.contrib.contenttypes',
+)
+
+ROOT_URLCONF = 'django_browserid.tests.urls'
+
+AUTHENTICATION_BACKENDS = (
+ 'django_browserid.auth.BrowserIDBackend',
+)
+
+SITE_URL = 'http://testserver'
@@ -0,0 +1,5 @@
+from django.conf.urls.defaults import include, patterns
+
+urlpatterns = patterns('',
+ (r'^browserid/', include('django_browserid.urls')),
+)
View
@@ -1,8 +1,9 @@
from django.conf.urls.defaults import patterns, url
-from views import BrowserID_Verify
+from django_browserid.views import Verify
+
urlpatterns = patterns('',
- url('^browserid/verify/', BrowserID_Verify.as_view(),
+ url('^browserid/verify/', Verify.as_view(),
name='browserid_verify')
)
View
@@ -0,0 +1,19 @@
+import os
+
+from fabric.api import local
+
+
+ROOT = os.path.abspath(os.path.dirname(__file__))
+os.environ['PYTHONPATH'] = ROOT
+
+
+def test():
+ """Run test suite."""
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'django_browserid.tests.settings'
+ os.environ['REUSE_DB'] = '0'
+
+ # Add tables and flush DB
+ local('django-admin.py syncdb --noinput')
+ local('django-admin.py flush --noinput')
+
+ local('django-admin.py test')
View
@@ -2,5 +2,6 @@ requests==0.9.1
# Tests
mock==0.8.0
--e git://github.com/jbalogh/django-nose.git@b130825#egg=django-nose
Django==1.3
+django-nose
+fabric

1 comment on commit 0a8cad6

r+

Please sign in to comment.