def test_passed_cert_to_verify_cert(self):
        client = http.HTTPClient('https://foo', ca_file="NOWHERE")
        self.assertEqual("NOWHERE", client.verify_cert)

        self.m.StubOutWithMock(http, 'get_system_ca_file')
        http.get_system_ca_file().AndReturn("SOMEWHERE")
        self.m.ReplayAll()
        client = http.HTTPClient('https://foo')
        self.assertEqual("SOMEWHERE", client.verify_cert)
    def test_passed_cert_to_verify_cert(self):
        client = http.HTTPClient('https://foo', ca_file="NOWHERE")
        self.assertEqual("NOWHERE", client.verify_cert)

        self.m.StubOutWithMock(http, 'get_system_ca_file')
        http.get_system_ca_file().AndReturn("SOMEWHERE")
        self.m.ReplayAll()
        client = http.HTTPClient('https://foo')
        self.assertEqual("SOMEWHERE", client.verify_cert)
Example #3
0
 def test_get_system_ca_file(self, mock_request):
     chosen = '/etc/ssl/certs/ca-certificates.crt'
     with mock.patch('os.path.exists') as mock_os:
         mock_os.return_value = chosen
         ca = http.get_system_ca_file()
         self.assertEqual(chosen, ca)
         mock_os.assert_called_once_with(chosen)
 def test_get_system_ca_file(self, mock_request):
     chosen = '/etc/ssl/certs/ca-certificates.crt'
     with mock.patch('os.path.exists') as mock_os:
         mock_os.return_value = chosen
         ca = http.get_system_ca_file()
         self.assertEqual(chosen, ca)
         mock_os.assert_called_once_with(chosen)
    def test_get_system_ca_file(self):
        chosen = '/etc/ssl/certs/ca-certificates.crt'
        self.m.StubOutWithMock(os.path, 'exists')
        os.path.exists(chosen).AndReturn(chosen)
        self.m.ReplayAll()

        ca = http.get_system_ca_file()
        self.assertEqual(chosen, ca)
    def test_get_system_ca_file(self):
        chosen = '/etc/ssl/certs/ca-certificates.crt'
        self.m.StubOutWithMock(os.path, 'exists')
        os.path.exists(chosen).AndReturn(chosen)
        self.m.ReplayAll()

        ca = http.get_system_ca_file()
        self.assertEqual(chosen, ca)