Exemplo n.º 1
0
 def test_web_http(self):
     service = WebService('asdf.com')
     result = service.try_check(WebCheck('http', '', 200, WebCheck.STATUS))
     self.assertEqual(True, result.success)
     self.assertEqual('http://asdf.com/ returned 200 (should be 200)', result.message)
Exemplo n.º 2
0
 def test_web_http_manual_port(self):
     service = WebService('sparsa.org', 80)
     result = service.try_check(WebCheck('http', '', 200, WebCheck.STATUS))
     self.assertEqual(True, result.success)
     self.assertEqual('http://sparsa.org/ returned 200 (should be 200)', result.message)
Exemplo n.º 3
0
 def test_web_http_server_down(self):
     service = WebService('8.8.8.8')
     result = service.try_check(WebCheck('http', '', 200, WebCheck.STATUS))
     self.assertEqual(service.connection_error(), result)
Exemplo n.º 4
0
 def test_web_http_content_contains_fail(self):
     service = WebService('asdf.com')
     result = service.try_check(WebCheck('http', '', 'keyword string to match', WebCheck.CONTENT_CONTAINS))
     self.assertEqual(False, result.success)
     self.assertEqual("http://asdf.com/ did not contain 'keyword string to match'", result.message)
Exemplo n.º 5
0
 def test_web_http_content_contains(self):
     service = WebService('asdf.com')
     result = service.try_check(WebCheck('http', '', '<title>asdf</title>', WebCheck.CONTENT_CONTAINS))
     self.assertEqual(True, result.success)
     self.assertEqual('http://asdf.com/ contained check content', result.message)
Exemplo n.º 6
0
 def test_web_http_404(self):
     service = WebService('asdf.com')
     result = service.try_check(WebCheck('http', 'not-there.html', 404, WebCheck.STATUS))
     self.assertEqual(True, result.success)
     self.assertEqual('http://asdf.com/not-there.html returned 404 (should be 404)', result.message)