Thanks for your answer and your assumption is correct, that's how the redirect looks.
A quickfix in the test was to use a response without follow=True and response['location'] to test the redirect (which only went one step). Marcus On Wednesday, October 15, 2014 5:31:40 PM UTC+2, Tom Evans wrote: > > On Wed, Oct 15, 2014 at 2:20 PM, Marcus <kam...@gmail.com <javascript:>> > wrote: > > 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. > > > > I think you are returning a redirect that is not a sub class of > HttpResponseRedirectBase - ie this will not work: > > rsp = HttpResponse(content='Content Found', status=301) > rsp['Location'] = 'http://foo/bar' > return rsp > > as it is not a HttpResponseRedirectBase. > > This was introduced by e94f405, which fixes case #18558 > > https://code.djangoproject.com/ticket/18558 > > I think this fix is wrong, since it means that one kind of > HttpResponse is treated differently to the equivalent, derived type. > > Cheers > > Tom > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5a3763c2-da67-4624-b028-7d4c6672d5a9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.