Commit Graph

135 Commits

Author SHA1 Message Date
Russell Keith-Magee 6755a039eb Fixed #12542 -- Added the TEST_MIRROR setting, allowing testing of read slave databases.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-25 12:05:38 +00:00
Russell Keith-Magee f114fbecc2 Fixed #12659 -- Return a more meaningful KeyError message when ContextList lookups fail. Thanks to rodriguealcazar for the suggestion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12274 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 15:31:14 +00:00
Russell Keith-Magee 7ca9d9306c Fixed #10314 -- Added a message prefix argument to Django's test assertions. Thanks to Wes Winham for the original suggestion, and Chistian Oudard for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12273 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-22 15:02:02 +00:00
Russell Keith-Magee e2d094b8fb Fixed #12640 -- Corrected a regression in test suite construction order introduced by #12255. Also updated the docs to reflect what the test code has always done. Thanks to Ramiro Morales for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12261 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-19 01:14:02 +00:00
Russell Keith-Magee 53b61d9c02 Fixed #12624 -- Modified test runners to be class based.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12255 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-18 15:11:01 +00:00
Russell Keith-Magee e07560a88e Modified the way EMAIL_BACKEND is specified to make it consistent with the new "use the class name" policy for backends.
This is a BACKWARDS-INCOMPATIBLE CHANGE for anyone using a manually
specified EMAIL_BACKEND setting. If you have manually specified
EMAIL_BACKEND, you will need to append ".EmailBackend" to your
existing EMAIL_BACKEND setting. See the django-dev mailing list for
details.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-04 12:05:04 +00:00
Karen Tracey dae4972b4d Ensure the default keyboard interrupt handler is restored
even if the test runner raises an exception.  Thanks Alex
Gaynor.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@12036 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-31 19:52:26 +00:00
Karen Tracey 9a55432213 Fixed #12364: Added graceful exit from a test run when Ctrl-C is pressed. Thanks Randy Barlow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-31 18:48:28 +00:00
Russell Keith-Magee ff60c5f9de Fixed #1142 -- Added multiple database support.
This monster of a patch is the result of Alex Gaynor's 2009 Google Summer of Code project.
Congratulations to Alex for a job well done.

Big thanks also go to:
 * Justin Bronn for keeping GIS in line with the changes,
 * Karen Tracey and Jani Tiainen for their help testing Oracle support
 * Brett Hoerner, Jon Loyens, and Craig Kimmerer for their feedback.
 * Malcolm Treddinick for his guidance during the GSoC submission process.
 * Simon Willison for driving the original design process
 * Cal Henderson for complaining about ponies he wanted.

... and everyone else too numerous to mention that helped to bring this feature into fruition.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11952 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22 15:18:51 +00:00
Russell Keith-Magee 44b9076bbe Fixed #6262 -- Added a cached template loader, and modified existing template loaders and tag to be cacheable. Thanks to Mike Malone for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-14 12:08:23 +00:00
Karen Tracey 92eec3ef9a Fixed #11613: Added a failfast option for test running. Thanks jukvalim and Randy Barlow.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-13 16:24:36 +00:00
Russell Keith-Magee b59aa81d68 Corrected the order of operations in the test environment setup to ensure that the original email backend can be restored. Thanks to koenb for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11718 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-04 10:31:37 +00:00
Russell Keith-Magee aba5389326 Fixed #10355 -- Added an API for pluggable e-mail backends.
Thanks to Andi Albrecht for his work on this patch, and to everyone else that contributed during design and development.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11709 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-11-03 12:53:26 +00:00
Luke Plant 8e70cef9b6 Fixed #9977 - CsrfMiddleware gets template tag added, session dependency removed, and turned on by default.
This is a large change to CSRF protection for Django.  It includes:

 * removing the dependency on the session framework.
 * deprecating CsrfResponseMiddleware, and replacing with a core template tag.
 * turning on CSRF protection by default by adding CsrfViewMiddleware to
   the default value of MIDDLEWARE_CLASSES.
 * protecting all contrib apps (whatever is in settings.py)
   using a decorator.

For existing users of the CSRF functionality, it should be a seamless update,
but please note that it includes DEPRECATION of features in Django 1.1,
and there are upgrade steps which are detailed in the docs.

Many thanks to 'Glenn' and 'bthomas', who did a lot of the thinking and work
on the patch, and to lots of other people including Simon Willison and
Russell Keith-Magee who refined the ideas.

Details of the rationale for these changes is found here:

http://code.djangoproject.com/wiki/CsrfProtection

As of this commit, the CSRF code is mainly in 'contrib'.  The code will be
moved to core in a separate commit, to make the changeset as readable as
possible.



git-svn-id: http://code.djangoproject.com/svn/django/trunk@11660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-26 23:23:07 +00:00
Jacob Kaplan-Moss d1da261417 Fixed #11371: Made `django.test.Client.put()` work for non-form-data PUT (i.e. JSON, etc.). Thanks, phyfus.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11656 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-26 15:02:54 +00:00
Karen Tracey 50745cc31e Fixed #11066 -- Corrected 15 duplicate "the"s found in docs and code comments. Thanks kaikuehne.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-17 16:45:28 +00:00
Karen Tracey d463580c1b Fixed #10831 -- Prevented code running under a to-be-rolled-back test from calling commit via transaction.managed(False). Thanks seanl for report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10621 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-22 19:10:28 +00:00
Russell Keith-Magee 8dc73e8425 Fixed #10571 -- Ensured that unicode POST data is correctly encoded by the test client. Thanks to Rick Wagner for his help identifying and fixing this problem.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10513 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 09:20:10 +00:00
Russell Keith-Magee 366710e636 Fixed #10183 -- Corrected the handling of unicode in assertContains and assertNotContains. Thanks to trbs for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10414 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-07 12:06:05 +00:00
Karen Tracey 78b5c65844 Fixed #10676 -- Make transaction nop routine used during testing accept any args/kwargs it might be called with. Thanks seanl.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 13:04:28 +00:00
Gary Wilson Jr 13ea4a9133 Fixed #9978 -- Fixed a KeyError exception that was being raised when using the logout method on the test client on an unauthenticated user, based on patch from ericholscher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10228 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:52:48 +00:00
Malcolm Tredinnick 420a35b9b7 Python 2.3 fix: assertTrue *still* doesn't exist in Python 2.3
The tests and testing framework should use failUnless() instead.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10100 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 01:37:34 +00:00
Jacob Kaplan-Moss c485e236bd Fixed #8193: all dynamic imports in Django are now done correctly. I know this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett!
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 16:55:59 +00:00
Russell Keith-Magee ee2f04d79e Fixed #10482 -- Unified access to response.context when inspecting responses from the test client. Thanks to James Bennett for the design, and Julien Phalip for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10084 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18 10:46:55 +00:00
Malcolm Tredinnick beb20057a3 Fixed #10165 -- Use settings.TEST_RUNNER in runtests.py
This permits running Django's core tests under an alternative test runner. Most
likely useful to non-CPython implementations, rather than much else (since
Django's core tests might assume things about the test runner).

Patch from Leo Soto.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9918 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-28 04:46:38 +00:00
Russell Keith-Magee e735fe7160 Fixed #4476 -- Added a ``follow`` option to the test client request methods. This implements browser-like behavior for the test client, following redirect chains when a 30X response is received. Thanks to Marc Fargas and Keith Bussell for their work on this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-27 13:14:59 +00:00
Russell Keith-Magee 5f7c6a8d29 Fixed #9031 -- Clarified the error message when the label used to run a specific test case method doesn't name a valid test case class. Thanks to Thomas Guettler for the suggestion and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9879 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-22 08:34:51 +00:00
Russell Keith-Magee cd0611bd83 Fixed #8551 -- Added REMOTE_ADDR to the default Test Client environment. Thanks to schmichael for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-21 07:19:12 +00:00
Karen Tracey 3c87c22b3c Added code to make TestSuites iterable when running on Python 2.3. (r9756 added code that iterates over them, thus broke running tests on Python 2.3, sigh.)
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-17 22:04:40 +00:00
Karen Tracey 344f16e220 Fixed #8138 -- Changed django.test.TestCase to rollback tests (when the database supports it) instead of flushing and reloading the database. This can substantially reduce the time it takes to run large test suites.
This change may be slightly backwards incompatible, if existing tests need to test transactional behavior, or if they rely on invalid assumptions or a specific test case ordering.  For the first case, django.test.TransactionTestCase should be used.  TransactionTestCase is also a quick fix to get around test case errors revealed by the new rollback approach, but a better long-term fix is to correct the test case.  See the testing doc for full details.

Many thanks to:
* Marc Remolt for the initial proposal and implementation.
* Luke Plant for initial testing and improving the implementation.
* Ramiro Morales for feedback and help with tracking down a mysterious PostgreSQL issue.
* Eric Holscher for feedback regarding the effect of the change on the Ellington testsuite.
* Russell Keith-Magee for guidance and feedback from beginning to end.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9756 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 02:30:22 +00:00
Russell Keith-Magee cc4e4d9aee Fixed #3566 -- Added support for aggregation to the ORM. See the documentation for details on usage.
Many thanks to:
 * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
 * Alex Gaynor for his help debugging and fixing a number of issues.
 * Justin Bronn for his help integrating with contrib.gis.
 * Karen Tracey for her help with cross-platform testing.
 * Ian Kelly for his help testing and fixing Oracle support.
 * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 11:06:34 +00:00
Russell Keith-Magee 98ec741a03 Fixed #9585 -- Corrected code committed in [9398] that wasn't compatible with Python 2.3/2.4. Thanks to Karen Tracey for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9465 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-16 08:20:25 +00:00
Russell Keith-Magee 95d8c0619a Fixed #9351 -- Modified the test client to pass on URL encoded parameters to the underlying views. Thanks to sime for the suggestion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9398 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-12 11:22:05 +00:00
Russell Keith-Magee a53ccc8297 Fixed #9369 -- Added QUERY_STRING info for PUT and DELETE requests in the test client. Thanks to david for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9397 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-12 11:20:32 +00:00
Russell Keith-Magee ecc1ed4ce1 Fixed #8646 -- Modified test client to set a fully WSGI compliant environment. Thanks to Adam Lofts for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9396 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-11-12 11:19:37 +00:00
Malcolm Tredinnick cd8eeaacf5 Fixed #5888 -- Added methods to the test client to support HEAD, PUT, DELETE
and OPTIONS support. Thanks Scott Barr and Leah Culver.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9188 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-10-07 09:23:40 +00:00
Russell Keith-Magee eeb230aa1c Fixed #9117: Made the test client a new-style class. Thanks to Jan Oberst for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9066 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-09-17 11:32:11 +00:00
Russell Keith-Magee 229f2c1ca0 Fixed #8636: Corrected the test client to use the string '80' in the request META, rather than the integer 80. Thanks to Adam Lofts for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8655 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-28 11:52:50 +00:00
Russell Keith-Magee 50b548d01b Fixed #7416: Modified test client to preserve session when a user logs in. Thanks to lakin.wecker@gmail.com for the report and Eric Holscher for the patch and test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8372 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15 12:08:29 +00:00
Russell Keith-Magee 9dc4ba875f Fixed #5461 -- Refactored the database backend code to use classes for the creation and introspection modules. Introduces a new validation module for DB-specific validation. This is a backwards incompatible change; see the wiki for details.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8296 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-11 12:11:25 +00:00
Jacob Kaplan-Moss 34a3bd5225 Major refactoring of django.dispatch with an eye towards speed. The net result is that signals are up to 90% faster.
Though some attempts and backwards-compatibility were made, speed trumped compatibility. Thus, as usual, check BackwardsIncompatibleChanges for the complete list of backwards-incompatible changes.

Thanks to Jeremy Dunck and Keith Busell for the bulk of the work; some ideas from Brian Herring's previous work (refs #4561) were incorporated.

Documentation is, sigh, still forthcoming.

Fixes #6814 and #3951 (with the new dispatch_uid argument to connect).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8223 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-06 15:32:46 +00:00
Malcolm Tredinnick bfcecbffd3 Changed/fixed the way Django handles SCRIPT_NAME and PATH_INFO (or
equivalents). Basically, URL resolving will only use the PATH_INFO and the
SCRIPT_NAME will be prepended by reverse() automatically. Allows for more
portable development and installation. Also exposes SCRIPT_NAME in the
HttpRequest instance.

There are a number of cases where things don't work completely transparently,
so mod_python and fastcgi users should read the relevant docs.

Fixed #285, #1516, #3414.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8015 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-21 07:57:10 +00:00
Russell Keith-Magee 2f49d18071 Fixed #7441 -- Removed some of the shortcuts in the doctest output comparators, and added a wrapper to allow comparison of xml fragments. Thanks to Leo Soto for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8003 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-20 05:46:41 +00:00
Malcolm Tredinnick 189c704ae6 Revert [7991] - [7993]. I was committing from the wrong branch. Sorry 'bout
that, folks. :-(


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7995 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:37:55 +00:00
Malcolm Tredinnick b653cdcfb2 First part of setting request.path correctly.
Still needs:
    - testing
    - docs changes
    - some way of fixing reverse().


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7991 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 19:32:01 +00:00
Russell Keith-Magee 0cffff024b Fixed #7441 - Improved the doctest OutputChecker to be more lenient with JSON an XML outputs. This is required so that output ordering that doesn't matter at a semantic level (such as the order of keys in a JSON dictionary, or attributes in an XML element) isn't caught as a test failure. Thanks to Leo Soto for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-19 14:46:55 +00:00
Malcolm Tredinnick c681f4070c Removed the mysql_old backend. It smells bad and has no friends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-18 17:38:53 +00:00
Russell Keith-Magee 1107e6b479 Fixed #7751 -- Added check to allow for the fact that autocommit can be a property, rather than a function on certain database backends. Thanks to Leo Soto for the fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7940 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-17 13:24:05 +00:00
Jacob Kaplan-Moss 9dabd1f8ff Fixed #7651: uploading multiple files with the same name now work. Also, in order to test the problem the test client now handles uploading multiple files at once. Patch from Mike Axiak.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7858 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-07 22:06:32 +00:00
Gary Wilson Jr f5c1bb1cad Got rid of a bit of repetition by using `dict.update()`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-02 04:48:58 +00:00