1. Mikhail Korobov
  2. django-webtest
  3. Issues
Issue #5 resolved

DeprecationWarning status_code

Reik Schatz
created an issue

Running Django 1.3 with django-webtest 1.3. Trying to test a form like this:

form = self.app.get(reverse('suggest_page')).form self.assertContains(form.response, 'element-with-description sg', 2)

The error I hit: DeprecationWarning: The attribute status_code is deprecated: use .status or .status_int instead

Apparently there is a mismatch between the expected Response and the given Response. Full Traceback:


Traceback (most recent call last): File "/home/reik/Dev/webapp/tests/suggest_view_tests.py", line 17, in testInitialValues self.assertContains(form.response, 'element-with-description sg', 2, 200, '')

File "/usr/local/lib/python2.6/dist-packages/Django-1.3-py2.6.egg/django/test/testcases.py", line 419, in assertContains self.assertEqual(response.status_code, status_code,

File "/usr/local/lib/python2.6/dist-packages/WebOb-1.0.7-py2.6.egg/webob/descriptors.py", line 139, in get self.warn()

File "/usr/local/lib/python2.6/dist-packages/WebOb-1.0.7-py2.6.egg/webob/descriptors.py", line 158, in warn 'The attribute %s is deprecated: %s' % (self.attr, self.message)) DeprecationWarning: The attribute status_code is deprecated: use .status or .status_int instead

Comments (2)

  1. Log in to comment