def test_run_exception(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep').AndRaise(Exception('test test'))
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13)
     self.assertEqual('Exception', check.results['Exception-Type'])
     self.assertEqual('test test', check.results['Exception-Value'])
 def test_run_exception(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep').AndRaise(Exception('test test'))
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13)
     self.assertEqual('Exception', check.results['Exception-Type'])
     self.assertEqual('test test', check.results['Exception-Value'])
 def test_run(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep')
     check._get_banner().AndReturn('beep beep')
     check._check_banner('beep beep')
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13)
 def test_run(self):
     check = SmtpHealthCheck()
     check.sock = self.mox.CreateMockAnything()
     self.mox.StubOutWithMock(check, '_lookup')
     self.mox.StubOutWithMock(check, '_connect')
     self.mox.StubOutWithMock(check, '_get_banner')
     self.mox.StubOutWithMock(check, '_check_banner')
     check._lookup('test', 13).AndReturn('beep')
     check._connect('beep')
     check._get_banner().AndReturn('beep beep')
     check._check_banner('beep beep')
     check.sock.close()
     self.mox.ReplayAll()
     check.run('test', 13)