Commit Graph

51 Commits

Author SHA1 Message Date
Russell Keith-Magee afd040d4d3 Updated test assertions that have been deprecated by the move to unittest2. In summary, this means:
assert_ -> assertTrue
 assertEquals -> assertEqual
 failUnless -> assertTrue

For full details, see http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-03-03 15:04:39 +00:00
Luke Plant 2366415f48 Fixed #15368 - test failures due to regression with RequestContext
Thanks to cyberdelia for the reports on this.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15660 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-02-27 00:24:35 +00:00
Ramiro Morales 190f6e5b45 Fixed #14753 -- Fixed the test client to not raise an AssertionError when request.raw_post_data is accessed from a view it has fetched with GET. Thanks zimnyx for the report and ojii for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15254 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-21 01:04:05 +00:00
Alex Gaynor d140318099 Fixed a regression in the test suite from [15236].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-19 14:41:40 +00:00
Jannis Leidel 3db76ff2d0 Fixed #14468 -- Extended the list of content types that the test client could guess when handling zip files. Thanks, Russ and emulbreh.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15236 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-01-17 23:58:51 +00:00
Alex Gaynor 5bc0ec4ec4 Removed all usages of deprecated TestCase methods (self.fail*). This removed most of the Warnings emitted (with -Wall) during the test suite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-12-04 07:28:12 +00:00
Russell Keith-Magee 121d2e3678 Fixed #12991 -- Added unittest2 support. Thanks to PaulM for the draft patch, and to Luke, Karen, Justin, Alex, Łukasz Rekucki, and Chuck Harmston for their help testing and reviewing the final patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14139 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-11 12:55:17 +00:00
Carl Meyer 501546df6f Fixed #12226 -- Deprecated test client Response.template attribute in favor of templates attribute, which is always a list. Thanks Russell for patch review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14106 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-10 02:16:33 +00:00
Russell Keith-Magee 26b3fb1e82 Fixed #13140 -- Ensure that request headers are preserved through redirect chains in the test client. Thanks to David Novakovic for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13620 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-21 03:01:46 +00:00
Russell Keith-Magee 917f433727 Fixed #11159 -- Added mimetype detection to the test client for file uploads. Thanks to notanumber for the report and patch, and lomin for the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13517 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-06 17:14:02 +00:00
Russell Keith-Magee 9767993a24 Fixed #13615 -- Clarified test assertion text to avoid confusion when response content isn't a web page. Thanks to DaNmarner for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13512 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-06 16:54:17 +00:00
Russell Keith-Magee 6eb7cd1af4 Fixed #13092 -- Added support for the "in" operator when dealing with context lists. Thanks to clelland for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13510 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-08-06 16:34:34 +00:00
Russell Keith-Magee f081059b45 Fixed #13152 -- Ensure the test client saves the session before writing the session key to the cookie, in case the session engine changes the session key.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12806 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-19 05:42:13 +00:00
Jacob Kaplan-Moss 76afc30229 Fixed a couple Python 2.4 incompatibilities.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12434 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-14 20:29:42 +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 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
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
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
Gary Wilson Jr b4f5655c86 Fixed #10553 -- Corrected several uses of `URLconf` in documentation and comments, according to the Django style guide. Based on patch from rduffield.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10256 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 16:07:07 +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
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
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 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
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 e054295fed Fixed #8136: Added a signal emission when an error is raised handling an error. This was required for the test client to handle missing 404.html templates and errors in the 404.html template. Thanks to danfairs for the report and fix.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8464 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-22 13:59:41 +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
Gary Wilson Jr c85c8f8891 Fixed #7919 -- md5 and sha modules are deprecated since Python 2.5, use hashlib module when available. Patch from Karen Tracey.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8193 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-02 05:56:57 +00:00
Gary Wilson Jr b149e3d9e7 Corrected typo.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8082 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-26 03:31:22 +00:00
Jacob Kaplan-Moss d725cc9734 Fixed #2070: refactored Django's file upload capabilities.
A description of the new features can be found in the new [http://www.djangoproject.com/documentation/upload_handing/ upload handling documentation]; the executive summary is that Django will now happily handle uploads of large files without issues.

This changes the representation of uploaded files from dictionaries to bona fide objects; see BackwardsIncompatibleChanges for details.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7814 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-07-01 15:10:51 +00:00
Russell Keith-Magee 415bd694f9 Fixed #7521 -- Added the ability to customize ROOT_URLCONF for the duration of a TestCase. Thanks to Mark Fargas (telenieko) for his work on this patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7805 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-30 12:34:29 +00:00
Russell Keith-Magee 8a7bbc3c34 Fixed #5836 -- Corrected the logic in the Test Client when an exception raised by a view is caught and re-raised. Thanks for the report, test case, and fix, Chris Wagner.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7583 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-07 06:25:59 +00:00
Russell Keith-Magee 08401959d8 Fixed #7165 -- Added an assertNotContains() method to the test client. Thanks for the suggestion and implementation, J. Pablo Fernandez <pupeno@pupeno.com>.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-06 13:50:02 +00:00
Russell Keith-Magee 46cd8bb5b6 Fixed #7143 -- Modified the test client to better match (most) real browser behavior when uploading files. Now, only the file name is sent, rather than the full path. Thanks for the report, cpinto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7577 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-06 13:39:42 +00:00
Malcolm Tredinnick 597f9d6105 Fixed #5982 -- Changed test client's URL processing to match core's (everything
gets run through urllib.unquote()). Patch from Leo Shklovskii and Russell
Keith-Magee.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7330 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-03-20 06:50:54 +00:00
Malcolm Tredinnick 3ee3d6b5f3 Fixed #5898 -- Changed a few response processing paths to make things harder to get wrong and easier to get right. Previous behaviour wasn't buggy, but it was harder to use than necessary.
We now have automatic HEAD processing always (previously required ConditionalGetMiddleware), middleware benefits from the Location header rewrite, so they can use relative URLs as well, and responses with response codes 1xx, 204 or 304 will always have their content removed, in accordance with the HTTP spec (so it's much harder to indavertently deliver invalid responses).

Based on a patch and diagnosis from regexbot@gmail.com.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6662 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-11-11 03:55:44 +00:00
Malcolm Tredinnick ea3e89cb1d Fixed a bunch of Python 2.3 issues. Two tests still fail, but this fixes the bulk of things.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6183 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 09:55:17 +00:00
Malcolm Tredinnick eabb57f6f0 Fixed tests to match new HTTP redirect behaviour. We always redirect to absolute URLs now.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-14 06:05:54 +00:00
Gary Wilson Jr 1da7b5cde7 Added test for unknown non-field error.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-04 00:48:19 +00:00
Russell Keith-Magee d1d4d018bf Fixed #5330 -- Added a fixture file that was missing from [6039].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6042 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-03 23:41:24 +00:00
Gary Wilson Jr bce7de9647 Removed some duplication in the Django `TestCase` methods by introducing a `to_list` function for putting a value into a list if it's not already one.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6041 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-03 23:14:51 +00:00
Russell Keith-Magee 3bf4ef0c77 Fixed #4988 -- In the test client, Added tracking of the client and request that caused a response so that the assertRedirects check can use the correct client when following a redirect. Well spotted, alex@gc-web.de.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6039 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-09-03 11:21:40 +00:00
Russell Keith-Magee 5ad08583e1 Fixed #4968 -- Added assertRedirects handling for paths with GET data. Thanks for the patch, Ivan Sagalaev.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6031 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-08-31 11:37:28 +00:00
Russell Keith-Magee 6a4f164a6f Added test cases for change [5739].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5740 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-21 05:15:19 +00:00
Adrian Holovaty 07dd6b2895 Fixed negligible typo in docstring in tests/regressiontests/test_client_regress/models.py from [5731]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-20 15:40:54 +00:00
Russell Keith-Magee 56394220d5 Fixed #4901 -- Modified assertContains to provide a default check of 'any instances of text in content'. Thanks for the suggestion, nis@superlativ.dk.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5731 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-20 14:32:20 +00:00
Gary Wilson Jr 0816f380d2 Fixed #4779 -- Fixed a couple typos in the `test_client_regress` tests that surfaced when typo was corrected in [5620]. Thanks ferringb@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5621 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-06 04:04:42 +00:00
Malcolm Tredinnick 953badbea5 Merged Unicode branch into trunk (r4952:5608). This should be fully
backwards compatible for all practical purposes.

Fixed #2391, #2489, #2996, #3322, #3344, #3370, #3406, #3432, #3454, #3492, #3582, #3690, #3878, #3891, #3937, #4039, #4141, #4227, #4286, #4291, #4300, #4452, #4702


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5609 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-07-04 12:11:04 +00:00
Russell Keith-Magee c89dc9cfa0 Fixed some incorrect reporting of error messages in assertRedirects, and added test cases to validate.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5228 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2007-05-14 11:07:14 +00:00