Commit Graph

133 Commits

Author SHA1 Message Date
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Jon Dufresne 4468c08d70 Fixed #23968 -- Replaced list comprehension with generators and dict comprehension 2014-12-08 07:58:23 -05:00
Thomas Tanner 018d110ef5 Fixed #23911 -- Added support for buffer file uploads in the test client 2014-12-04 07:42:03 -05:00
wrwrwr 056a3c6c37 Fixed #23682 -- Enhanced circular redirects detection in tests.
When the test client detects a redirect to a URL seen in the
currently followed chain it will now raise a RedirectCycleError
instead of just returning the first repeated response.

It will also complain when a single chain of redirects is longer
than 20, as this often means a redirect loop with varying URLs,
and even if it's not actually one, such long chains are likely
to be treated as loops by browsers.

Thanks Preston Timmons, Berker Peksag, and Tim Graham for reviews.
2014-11-25 10:12:28 -05:00
Rigel Di Scala 28634394f5 Fixed #23606 -- Implemented Client and RequestFactory trace() methods.
Thanks KevinEtienne for the suggestion.
2014-10-28 10:11:12 -04:00
Claude Paroz f0bb3c98cc Fixed #21740 -- Allowed test client data to be an empty string
This fixes a regression introduced by 2a31d00933.
Thanks tony-zhu for the report.
2014-10-21 09:16:57 +02:00
Anubhav Joshi 10b17a22be Fixed #19508 -- Implemented uri_to_iri as per RFC.
Thanks Loic Bistuer for helping in shaping the patch and Claude Paroz
for the review.
2014-10-16 02:31:17 +07:00
Joshua "jag" Ginsberg eb2af16c59 Fixed #21483 -- Added WSGI environ to kwargs sent to request_started signal. 2014-08-29 10:12:03 -04:00
Xavier Fernandez 50b9313e0a Fixed #22771 -- Fixed test.Client.logout when using custom auth backend. 2014-06-13 13:03:58 -04:00
Greg Chapple bf743a4d57 Fixed #16087 -- Added ResolverMatch instance to test client response.
Thanks mrmachine for the suggestion.
2014-06-13 08:50:43 -04:00
Preston Timmons be88b062af Fixed #21357 -- Fixed test client session initialization.
The test client will now create a session when it is first accessed
if no session already exists.
2014-05-22 20:29:48 -04:00
Tim Graham aabceadd7d Revert "Fixed #15179 -- middlewares not applied for test client login()"
This reverts commit 4fdd51b732.

See the ticket for concerns with this implementation; it will be revisited.
2014-04-28 18:41:36 -04:00
Florian Apolloner 474eeccb52 Fixed a typo (I guess). 2014-02-13 17:36:53 +01:00
Russell Keith-Magee 56516ade5e Refs #21831 -- Softened the TestClient dependency on contrib.auth.
This is to prevent an import of django.test causing an import (and thus
an implicit checks regisration) for an app that may not be in
`INSTALLED_APPS`.

Better fixes may be possible when #20915 and/or #21829 are addressed.

Thanks to @carljm for the report.
2014-01-21 08:51:23 +08:00
Claude Paroz 2a31d00933 Fixed #21740 -- Stopped using mutable default arguments in test client
Thanks Denver Coneybeare for the report and initial patch, and
Atala for another patch.
2014-01-16 17:44:20 +01:00
Unai Zalakain 9eb16031ca Fixed #12571 -- Attached originating WSGIRequest to test client responses.
Originating WSGIRequests are now attached to the ``wsgi_request`` attribute of
the ``HttpResponse`` returned by the testing client.

Thanks rvdrijst for the suggestion.
2014-01-09 18:50:03 -05:00
Aymeric Augustin 6a320cc14a Fixed #21718 -- Renamed has_app to is_installed. 2014-01-06 22:48:41 +01:00
Aymeric Augustin 1716b7ce5a Renamed AppCache to Apps.
Also renamed app_cache to apps and "app cache" to "app registry".

Deprecated AppCache.app_cache_ready() in favor of Apps.ready().
2013-12-24 12:25:17 +01:00
Aymeric Augustin 2fef9e5375 Moved apps back in the toplevel django namespace.
Reverted 4a56a93cc4.
2013-12-22 11:39:55 +01:00
Aymeric Augustin 9cdf1f6d54 Stop testing for inclusion in INSTALLED_APPS.
Removed some exception masking in the comments app that was harmful and
couldn't be preserved easily.
2013-12-22 11:39:18 +01:00
Claude Paroz 384816fccb Fixed #21448 -- Fixed test client logout with cookie-based sessions
Thanks Gunnar Scherf for the report and the suggested patch.
2013-11-26 20:41:51 +01:00
Unai Zalakain 4fdd51b732 Fixed #15179 -- middlewares not applied for test client login()
Requests made with django.test.Client.login() and logout() respect
defaults defined in django.test.Client instantiation and are processed
through middleware.

Thanks to Loic for the reviews.
2013-11-19 09:04:20 +02:00
Boryslav Larin e737c009b8 Fixed flake8 E241 2013-11-02 21:45:40 +02:00
Unai Zalakain 99b681e227 Fixed #21341 -- Eased https requests with the test client
All request methods of ``django.test.client.Client`` receive a ``secure``
argument that defaults to ``False`` indicating whether or not to make the
request through https.
Thanks Aymeric Augustin for the review.
2013-11-02 19:03:13 +01:00
Aymeric Augustin a5b062576b Removed a few trailing backslashes.
We have always been at war with trailing backslashes.
2013-09-22 14:04:10 +02:00
Aymeric Augustin 476b07641c Oops :( 2013-09-07 11:32:39 -05:00
Aymeric Augustin 7bb6279360 Fixed an encoding issue in the test client.
Fixed
comment_tests.tests.test_comment_view.CommentViewTests.testCommentPostRedirectWithInvalidIntegerPK.

Refs #20530.
2013-09-07 11:31:08 -05:00
Alex Gaynor 2530735d2d Fixed a number of flake8 errors -- particularly around unused imports and local variables 2013-09-06 21:56:40 -07:00
Aymeric Augustin 6a6428a36f Took advantage of django.utils.six.moves.urllib.*. 2013-09-05 14:39:23 -05:00
Krzysztof Jurewicz 4eeb8ec147 Fixed #20864 -- Made the test client use common method for performing requests. 2013-08-13 19:08:13 -04:00
Bojan Mihelac 0cac4fbf69 Fixed #18356 -- Gave the test client signals.template_rendered call a unique dispatch_uid
This prevents the test client context from being lost when the client
is used in a nested fashion.
2013-08-09 12:22:42 -04:00
Claude Paroz fdd7a355bf Deprecated django.utils.importlib
This was a shim for pre-Python 2.7 support.
2013-07-29 17:10:22 +02:00
Benjamin Kagia b0953dc913 Fixed #13721 -- Added UploadedFile.content_type_extra.
Thanks Waldemar Kornewald and mvschaik for work on the patch.
2013-07-11 09:11:59 -04:00
Marc Tamlyn 0f3f88ec94 Merge pull request #1270 from tomchristie/remove-incorrect-content-type-test-client
Remove incorrect CONTENT_TYPE header from GET and HEAD requests
2013-06-14 01:49:33 -07:00
Tom Christie 1b19f9e9e7 Remove incorrect CONTENT_TYPE header from GET and HEAD requests 2013-06-14 09:17:33 +01:00
Tim Graham a35ed20241 Fixed #18924 -- Made test.Client.logout send user_logged_out signal.
Thanks awsum for the suggestion and Pavel Ponomarev and
Florian Hahn for the patch.
2013-06-04 12:39:09 -04:00
Aymeric Augustin 2ee21d9f0d Implemented persistent database connections.
Thanks Anssi Kääriäinen and Karen Tracey for their inputs.
2013-02-28 15:28:13 +01:00
Hiroki Kiyohara e94f405d94 Fixed #18558 -- Added url property to HttpResponseRedirect*
Thanks coolRR for the report.
2013-02-13 10:29:32 +01:00
Julien Phalip 293f7a2114 Fixed #17797 -- Enabled support for PATCH requests in the dummy test client. Thanks to pfarmer for the suggestion and initial patch. 2013-02-02 18:22:40 -08:00
Aymeric Augustin bacb097ac3 Fixed #19519 again -- Regression in LiveServerTestCase after fd1279a4. 2013-01-01 10:14:11 +01:00
Aymeric Augustin acc5396e6d Fixed #19519 -- Fired request_finished in the WSGI iterable's close(). 2012-12-31 12:47:34 +01:00
Aymeric Augustin 1e4a27d087 Fixed #19468 -- Decoded request.path correctly on Python 3.
Thanks aliva for the report and claudep for the feedback.
2012-12-22 13:32:39 +01:00
Aymeric Augustin d9a0b6ab36 Fixed #19487 -- Used str in the test client's WSGI environ.
This regression was introduced by the unicode_literals patch. The WSGI
spec mandates that environ contains native strings.
2012-12-22 10:38:27 +01:00
Claude Paroz dcbf08cce5 Fixed #19094 -- Improved FakePayload to support write, len and string input
Thanks Ondrej Slinták for the suggestion.
2012-10-20 15:36:24 +02:00
Claude Paroz ebc773ada3 Replaced many smart_bytes by force_bytes
In all those occurrences, we didn't care about preserving the
lazy status of the strings, but we really wanted to obtain a
real bytestring.
2012-08-29 11:20:32 +02:00
Claude Paroz a06503d09b [py3] Fixed content encoding in test client
Thanks Andrews Medina for the initial patch.
2012-08-13 09:56:14 +02:00
Claude Paroz 15fffcc751 [py3] Fixed reraising of exceptions
reraise with second argument to None is not supported.
2012-08-11 23:46:23 +02:00
Aymeric Augustin a8b3ddec5f [py3] Applied minor fixes so the test suite starts 2012-08-07 12:00:22 +02:00
Aymeric Augustin c5ef65bcf3 [py3] Ported django.utils.encoding.
* Renamed smart_unicode to smart_text (but kept the old name under
  Python 2 for backwards compatibility).
* Renamed smart_str to smart_bytes.
* Re-introduced smart_str as an alias for smart_text under Python 3
  and smart_bytes under Python 2 (which is backwards compatible).
  Thus smart_str always returns a str objects.
* Used the new smart_str in a few places where both Python 2 and 3
  want a str.
2012-08-07 12:00:22 +02:00
Aymeric Augustin 0d914d08a0 [py3] Updated urllib/urllib2/urlparse imports.
Lots of functions were moved. Use explicit imports in all cases
to keey it easy to identify where the functions come from.
2012-07-22 09:29:55 +02:00