helpers.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def assertRedirectsNoFollow(self, response, expected_url):
        """Check for redirect.

        Asserts that the given response issued a 302 redirect without
        processing the view which is redirected to.
        """
        if django.VERSION >= (1, 9):
            loc = six.text_type(response._headers.get('location', None)[1])
            loc = http.urlunquote(loc)
            expected_url = http.urlunquote(expected_url)
            self.assertEqual(loc, expected_url)
        else:
            self.assertEqual(response._headers.get('location', None),
                             ('Location', settings.TESTSERVER + expected_url))
        self.assertEqual(response.status_code, 302)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号