예제 #1
0
파일: test_api.py 프로젝트: SeyfSV/pypac
 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
예제 #2
0
파일: test_api.py 프로젝트: SeyfSV/pypac
 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
예제 #3
0
파일: test_api.py 프로젝트: SeyfSV/pypac
 def test_download_pac_timeout(self):
     assert download_pac([arbitrary_pac_url], timeout=0.001) is None
예제 #4
0
파일: test_api.py 프로젝트: rbcarson/pypac
 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
예제 #5
0
파일: test_api.py 프로젝트: rbcarson/pypac
 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
예제 #6
0
파일: test_api.py 프로젝트: rbcarson/pypac
 def test_download_pac_timeout(self):
     assert download_pac([arbitrary_pac_url], timeout=0.001) is None