def test_download_pac_content_type(self, headers, allowed_content_types, expected_value): """Test acceptance/rejection of obtained PAC based on Content-Type header.""" mock_pac_response = Mock(spec=requests.Response, ok=True, headers=headers, text=direct_pac_js) with _patch_request_base(mock_pac_response): result = download_pac([arbitrary_pac_url], allowed_content_types=allowed_content_types) assert result == expected_value
def test_download_pac_not_ok(self): mock_resp_not_ok = Mock(ok=False, headers=valid_pac_headers, text=direct_pac_js) with _patch_request_base(mock_resp_not_ok): assert download_pac([arbitrary_pac_url]) is None
def test_download_pac_timeout(self): assert download_pac([arbitrary_pac_url], timeout=0.001) is None