On 5/11/07, Jiri Barton <[EMAIL PROTECTED]> wrote: > > Thank you Russ, that has fixed the problem. > > I have a problem with the fix though; what if there were multiple > redirects? This just happened when I jumped to use your fix today: ... > This calls for some loop in the code of assertRedirects but I don't > know where to place it and how to check the redirect chain has > finished (return code starts with '3'?) - and detect infinte loops > possibly. > > I hate to bother you but please explain this to me or, could you fix > it?
I thought about this, and decided that it would be better to require the user to do multiple checks. Tests should always be atomic, and although they have the appearance to the user of being a single action, they are two very distinct actions on the part of the server. I suppose one option would be to make assertRedirects return the response from GETting the redirect page; that way you could chain the tests easily: response = self.client.get('/page') response = self.assertRedirects(response, '/first/') response = self.assertRedirects(response, '/second'/) ... but I'm not sure how I feel about assertRedirects being the only assert method that returns a value. Opinions? Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---