[Answered ]-How to follow the redirct and test again in test script

1👍

You can use follow=True to follow the redirect in a .post(…) call [Django-doc], so:

response = self.client.post(
    '/cms/content/up',
    {'name': 'test', 'content_file': fp, 'is_all': 'True'},
    follow=True
)

as is specified in the documentation:

If you set follow to True the client will follow any redirects and a redirect_chain attribute will be set in the response object containing tuples of the intermediate urls and status codes.

Leave a comment