Hi,
I just updated Django from an older version to 1.6.7 and some of my tests are now failing while trying to follow redirects.
In [1]: from django.test import Client
In [2]: import django
In [3]: django.VERSION
Out[3]: (1, 6, 7, 'final', 0)
In [4]: c = Client()
In [5]: r = c.get('/click/1/', follow=True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-507677d1861e> in <module>()
----> 1 r = c.get('/click/1/', follow=True)
/usr/local/lib/python2.7/site-packages/django/test/client.pyc in get(self, path, data, follow, **extra)
473 response = super(Client, self).get(path, data=data, **extra)
474 if follow:
--> 475 response = self._handle_redirects(response, **extra)
476 return response
477
/usr/local/lib/python2.7/site-packages/django/test/client.pyc in _handle_redirects(self, response, **extra)
603 response.redirect_chain = []
604 while response.status_code in (301, 302, 303, 307):
--> 605 url = response.url
606 redirect_chain = response.redirect_chain
607 redirect_chain.append((url, response.status_code))
AttributeError: 'HttpResponse' object has no attribute 'url'
In [6]: r = c.get('/click/1/')
In [7]: r.status_code
Out[7]: 302
As far as I can see I am doing it like the documentation says (
https://docs.djangoproject.com/en/1.6/topics/testing/tools/#making-requests). I if downgrade to Django 1.5 follow=True works as it should.