Ejemplo n.º 1
0
 def test_wrap_ssl(self):
     check = SmtpHealthCheck()
     check.sock = 13
     ssl_sock = self.mox.CreateMock(ssl.SSLSocket)
     self.mox.StubOutWithMock(ssl, 'wrap_socket')
     ssl.wrap_socket(13).AndReturn(ssl_sock)
     ssl_sock.do_handshake()
     self.mox.ReplayAll()
     check._wrap_ssl()
     self.assertEqual(ssl_sock, check.sock)
Ejemplo n.º 2
0
 def test_wrap_ssl(self):
     check = SmtpHealthCheck()
     check.sock = 13
     ssl_sock = self.mox.CreateMock(ssl.SSLSocket)
     self.mox.StubOutWithMock(ssl, 'wrap_socket')
     ssl.wrap_socket(13).AndReturn(ssl_sock)
     ssl_sock.do_handshake()
     self.mox.ReplayAll()
     check._wrap_ssl()
     self.assertEqual(ssl_sock, check.sock)
Ejemplo n.º 3
0
 def test_run_ssl(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_wrap_ssl')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep')
     check._wrap_ssl()
     check._get_banner().AndReturn('beep beep')
     check._check_banner('beep beep')
     check.sock.unwrap().AndReturn(check.sock)
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13, with_ssl=True)
Ejemplo n.º 4
0
 def test_run_ssl(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_wrap_ssl')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep')
     check._wrap_ssl()
     check._get_banner().AndReturn('beep beep')
     check._check_banner('beep beep')
     check.sock.unwrap().AndReturn(check.sock)
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13, with_ssl=True)