Commit Graph

31 Commits

Author SHA1 Message Date
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
Aymeric Augustin f88ad710fa Simplified caching of template context processors. 2014-11-19 21:35:39 +01:00
Aymeric Augustin 9eeb788cfb Refactored getting the list of template loaders.
This provides the opportunity to move utility functions specific to the
Django Template Language outside of django.template.loader.
2014-11-16 21:41:44 +01:00
Berker Peksag f7969b0920 Fixed #23620 -- Used more specific assertions in the Django test suite. 2014-11-03 11:56:37 -05: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
Tim Graham 4b257cf261 Fixed flake8 warnings. 2014-09-29 08:13:40 -04:00
Thomas Chaumeny b2aad7b836 Replaced set([foo, ...]) by {foo, ...} literals. Refs PR 3282.
Thanks Collin Anderson for the review.
2014-09-29 00:01:38 +07:00
Xavier Fernandez 50b9313e0a Fixed #22771 -- Fixed test.Client.logout when using custom auth backend. 2014-06-13 13:03:58 -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
Jacob R. Rothenbuhler 17c1884456 Fixed #22369 -- Added count parameter to assertTemplateUsed 2014-04-14 15:55:10 -04:00
Anubhav Joshi cd914e31c9 Fixed #21977 -- Deprecated SimpleTestCase.urls 2014-04-06 17:33:43 -04:00
Marc Tamlyn 2607fa9016 Fixed #21774 -- Isolate all test urls from eachother.
This (nearly) completes the work to isolate all the test modules from
each other. This is now more important as importing models from another
module will case PendingDeprecationWarnings if those modules are not in
INSTALLED_APPS. The only remaining obvious dependencies are:

- d.c.auth depends on d.c.admin (because of the is_admin flag to some
  views), but this is not so important and d.c.admin is in
  always_installed_apps
- test_client_regress depends on test_client. Eventually these should
  become a single module, as the split serves no useful purpose.
2014-01-14 15:43:27 +00:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +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
Unai Zalakain 9c5f6cd565 Fixed #13725 -- take url scheme into account in assertRedirects
Scheme is handled correctly when making comparisons between two URLs. If
there isn't any scheme specified in the location where we are redirected to,
the original request's scheme is used. If present, the scheme in
``expected_url`` is the one used to make the comparations to.
2013-11-07 19:06:32 +01:00
coagulant 8eec2d93b6 Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
Jason Myers c3791463a5 Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:48:47 -05:00
Alex Gaynor 9d740eb8b1 Fix all violators of E231 2013-10-26 12:15:03 -07:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -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
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
Chris Wilson fa7cb4ef3c Fixed #20404 -- Added a keys() method to ContextList.
It's useful to be able to list all the (flattened) keys of a
ContextList, to help you figure out why the variable that's supposed
to be there is not.

No .values() or .items() added as the definition for those aren't clear.

The patch is Chris Wilson's patch from pull request 1065 with some
modifications by committer.
2013-06-01 00:04:06 +03:00
Tim Graham d194714c0a Fixed #11603 - Added django.test.SimpleTestCase.assertFormsetError
Thank-you Martin Green for the patch.
2013-05-27 12:25:35 -04:00
Preston Holmes d228c1192e Fixed #19866 -- Added security logger and return 400 for SuspiciousOperation.
SuspiciousOperations have been differentiated into subclasses, and
are now logged to a 'django.security.*' logger. SuspiciousOperations
that reach django.core.handlers.base.BaseHandler will now return a 400
instead of a 500.

Thanks to tiwoc for the report, and Carl Meyer and Donald Stufft
for review.
2013-05-25 16:27:34 -07:00
Claude Paroz b04fd579d5 Fixed #20237 (again) Allowed binary parameter to assertContains 2013-04-12 20:12:42 +02:00
Claude Paroz fe01404bb9 Fixed #20237 -- Reenabled assertContains with binary parameter
Thanks Baptiste Mispelon for the review.
2013-04-11 10:38:24 +02:00
Florian Apolloner 33836cf88d Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00