Fix for final status code of redirect chain not failing (bug 830044)
This commit is contained in:
Родитель
565d14ef9f
Коммит
0920b5eab4
|
@ -115,7 +115,7 @@ def try_get_resource(err, package, url, filename, resource_type="URL",
|
|||
|
||||
http_cache[url] = data
|
||||
|
||||
if not data:
|
||||
if not data or request.status_code != 200:
|
||||
generic_http_error()
|
||||
|
||||
return data
|
||||
|
|
|
@ -160,6 +160,17 @@ class TestDataOutput(TestCase):
|
|||
self.err, None, "http://foo.bar/", ""), "")
|
||||
self.assert_failed(with_errors=True)
|
||||
|
||||
@patch("requests.get")
|
||||
@patch("appvalidator.constants.MAX_RESOURCE_SIZE", 100)
|
||||
def test_eventual_404(self, r_g):
|
||||
error_response = Mock()
|
||||
error_response.raw.read.side_effect = ["x" * 100, ""]
|
||||
error_response.status_code = 404
|
||||
r_g.return_value = error_response
|
||||
|
||||
appbase.try_get_resource(self.err, None, "http://foo.bar/", "")
|
||||
self.assert_failed(with_errors=True)
|
||||
|
||||
|
||||
class TestResourcePolling(TestCase):
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче