Skip to content

Commit

Permalink
Hackily converted tests to use django-sane-testing
Browse files Browse the repository at this point in the history
--HG--
rename : djangohttpdigest/tests/__init__.py => testproject/tests/__init__.py
rename : djangohttpdigest/tests/test_authentication.py => testproject/tests/test_authentication.py
rename : djangohttpdigest/tests/test_digest.py => testproject/tests/test_digest.py
rename : djangohttpdigest/tests/test_simple_digest.py => testproject/tests/test_simple_digest.py
  • Loading branch information
Almad committed Nov 11, 2009
1 parent ea5bd8a commit 859820b
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 119 deletions.
5 changes: 0 additions & 5 deletions run_tests

This file was deleted.

3 changes: 2 additions & 1 deletion testproject/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
MANAGERS = ADMINS

DATABASE_ENGINE = "sqlite3"
DATABASE_NAME = "/home/almad/tmp/httpdigesttest.db"
DATABASE_NAME = "/tmp/httpdigesttest.db"
TEST_DATABASE_NAME = "/tmp/httpdigesttest.db"
DATABASE_USER = ""
DATABASE_PASSWORD = ""
DATABASE_HOST = "localhost"
Expand Down
1 change: 0 additions & 1 deletion testproject/djangohttpdigest

This file was deleted.

36 changes: 0 additions & 36 deletions testproject/livetests.py

This file was deleted.

56 changes: 0 additions & 56 deletions testproject/server_runner.py

This file was deleted.

9 changes: 0 additions & 9 deletions testproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.transaction.TransactionMiddleware',
'django.middleware.http.SetRemoteAddrFromForwardedFor',
)

ROOT_URLCONF = 'testproject.urls'
Expand All @@ -41,11 +37,6 @@
)

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'testapi',
# OK, this is not really installed, but we want our testsuite to eat it
'djangohttpdigest',
Expand Down
1 change: 1 addition & 0 deletions testproject/testapi/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.db.transaction import commit_on_success
from django.http import HttpResponse
from djangohttpdigest.decorators import protect_digest, protect_digest_model

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import re
import urllib2

from django.test import TestCase
from django.http import HttpRequest
from django.core.handlers.wsgi import WSGIRequest

from djangohttpdigest.digest import Digestor, parse_authorization_header

class TestDigestor(TestCase):
from djangosanetesting import UnitTestCase

class TestDigestor(UnitTestCase):
""" Test digestor, our wrapping class for handling digests """

def setUp(self):
Expand Down Expand Up @@ -62,7 +59,7 @@ def test_bad_parsing_missing_digest(self):
auth_string = 'username="rpgpedia", realm="extproject", nonce="1cc6ab869fca869c2c085d78a3729a66", uri="/extproject/project/fc8afe5e-da35-4fe2-a991-7b26c829cde5/user/rpgpedia/salt/", response="69ead146a246cd51bbd076244d2e455b", opaque="ToDoMoveThisToSettings", algorithm="MD5", qop=auth, nc=00000001, cnonce="a84f8e6cfcd50a75"'
self.assertRaises(ValueError, lambda:self.digestor.parse_authorization_header(auth_string))

class TestSimpleDigest(TestCase):
class TestSimpleDigest(UnitTestCase):

environment = {
'HTTP_COOKIE': '',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import urllib2
import logging
from md5 import md5
from django.test import TestCase

from djangohttpdigest.client import HttpDigestClient

from module_test import LiveServerTestCase
from djangosanetesting import HttpTestCase

class TestSimpleDigest(LiveServerTestCase):
class TestSimpleDigest(HttpTestCase):
path = '/testapi/simpleprotected/'
url = 'http://localhost:8000'

Expand Down

0 comments on commit 859820b

Please sign in to comment.