def test_it_rejects_invalid_or_missing_urls(self):
invalid_urls = [None,
# Unsupported protocols.
'ftp://foo.bar',
'doi:10.1.2/345',
'file://foo.bar',
# Malformed URLs.
'http://goo\[g']
for url in invalid_urls:
request = mock_request()
request.GET['url'] = url
with pytest.raises(httpexceptions.HTTPBadRequest):
views.goto_url(request)
评论列表
文章目录