Re: [Django] #23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse

2014-11-03 Thread Django
#23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse
-+-
 Reporter:  zags |Owner:  davide-
 Type:  Bug  |  ceretti
Component:  Testing framework|   Status:  closed
 Severity:  Normal   |  Version:  master
 Keywords:  asserttemplateused   |   Resolution:  fixed
  template   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"2d06e3155a13e3ca9e63b97c7c9499a1e1ffd654"]:
 {{{
 #!CommitTicketReference repository=""
 revision="2d06e3155a13e3ca9e63b97c7c9499a1e1ffd654"
 Fixed #23300 -- Made assertTemplateUsed throw an error on responses not
 fetched using the test client.

 Thanks zags for the report and bmispelon for the patch.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.366b777ec66e7d89783240c6ba3f686c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse

2014-10-17 Thread Django
#23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse
-+-
 Reporter:  zags |Owner:  davide-
 Type:  Bug  |  ceretti
Component:  Testing framework|   Status:  assigned
 Severity:  Normal   |  Version:  master
 Keywords:  asserttemplateused   |   Resolution:
  template   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by loic):

 It's worth noting that `response.templates` is a monkey-patch from the
 `Client`; `assertTemplateused` won't work in any other context.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.5f02509aca9f3bf5e1dea3b3006695e9%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse

2014-10-11 Thread Django
#23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse
-+-
 Reporter:  zags |Owner:  davide-
 Type:  Bug  |  ceretti
Component:  Testing framework|   Status:  assigned
 Severity:  Normal   |  Version:  master
 Keywords:  asserttemplateused   |   Resolution:
  template   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  1
  Needs tests:  1|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by davide-ceretti):

 * owner:  nobody => davide-ceretti
 * status:  new => assigned
 * version:  1.6 => master


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.934c2ea7779cc5774b1ca5ffb2b9ffb6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse

2014-08-16 Thread Django
#23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse
-+-
 Reporter:  zags |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Testing framework|  Version:  1.6
 Severity:  Normal   |   Resolution:
 Keywords:  asserttemplateused   | Triage Stage:  Accepted
  template   |  Needs documentation:  1
Has patch:  1|  Patch needs improvement:  1
  Needs tests:  1|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by bmispelon):

 * needs_better_patch:  0 => 1
 * stage:  Unreviewed => Accepted
 * needs_tests:  0 => 1
 * needs_docs:  0 => 1


Comment:

 Hi,

 You can find the documentation for `assertTemplateused` at
 
https://docs.djangoproject.com/en/dev/topics/testing/tools/#django.test.SimpleTestCase.assertTemplateUsed.

 I looked into the issue a little bit and I agree with your analysis.
 As a fix, I would suggest raising an exception when trying to use
 `assertTemplateUsed` (or `assertTemplateNotUsed`) on a response object
 that doesn't have any `templates` attributes.
 Here's a simple patch that should apply cleanly on master:
 {{{#!diff
 diff --git a/django/test/testcases.py b/django/test/testcases.py
 index d46f672..6f7ab71 100644
 --- a/django/test/testcases.py
 +++ b/django/test/testcases.py
 @@ -502,10 +502,12 @@ class SimpleTestCase(unittest.TestCase):
"the response" % formset)

  def _assert_template_used(self, response, template_name, msg_prefix):
 -
  if response is None and template_name is None:
  raise TypeError('response and/or template_name argument must
 be provided')

 +if template_name is not None and response is not None and not
 hasattr(response, 'templates'):
 +raise ValueError("Response object %r has no attribute
 'templates'." % response)
 +
  if msg_prefix:
  msg_prefix += ": "
 }}}

 With this fix, your example now raises an exception and Django's test
 suite still passes.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.8ca8c86b312787aef84bfac2a4b14bd7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse (was: TestCase.assertTemplateUsed passes erroniously on an HttpResponse)

2014-08-15 Thread Django
#23300: TestCase.assertTemplateUsed passes erroneously on an HttpResponse
-+-
 Reporter:  zags |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Testing framework|  Version:  1.6
 Severity:  Normal   |   Resolution:
 Keywords:  asserttemplateused   | Triage Stage:
  template   |  Unreviewed
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by zags):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.bc722a991fbf8d617fba1fb700f2f0c2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.