def test_ssl_validation_unset(self): """ Assert that Curl is configured to do SSL validation by default when ssl_validation is unset. """ config = DownloaderConfig() curl_downloader = HTTPSCurlDownloader(config) easy_handle = mock.Mock() curl_downloader._add_ssl_configuration(easy_handle) self.assertEqual(easy_handle.setopt.call_count, 2) easy_handle.setopt.assert_any_call(pycurl.SSL_VERIFYPEER, 1) easy_handle.setopt.assert_any_call(pycurl.SSL_VERIFYHOST, 2)
def test_ssl_validation_true(self): """ Assert that Curl is configured to do SSL validation when ssl_validation is explicitly set to True. """ config = DownloaderConfig(ssl_validation=True) curl_downloader = HTTPSCurlDownloader(config) easy_handle = mock.Mock() curl_downloader._add_ssl_configuration(easy_handle) self.assertEqual(easy_handle.setopt.call_count, 2) easy_handle.setopt.assert_any_call(pycurl.SSL_VERIFYPEER, 1) easy_handle.setopt.assert_any_call(pycurl.SSL_VERIFYHOST, 2)