def test_output_result_unavailable(self): web_ping = WebPing(timeout=3) url_field = URLField( "test_ping", "title", "this is a test" ) result = WebPing.ping( url_field.to_python("http://192.168.30.23/"), timeout=3 ) out = StringIO() web_ping.output_result(result, "stanza", "title", unbroken=True, close=True, out=out) self.assertTrue(out.getvalue().find("timed_out=True") >= 0)
def test_output_result(self): web_ping = WebPing(timeout=3) url_field = URLField( "test_ping", "title", "this is a test" ) result = WebPing.ping( url_field.to_python("https://www.google.com/"), timeout=3 ) out = StringIO() web_ping.output_result(result, "stanza", "title", unbroken=True, close=True, out=out) self.assertTrue(out.getvalue().find("response_code=200") >= 0)
def test_output_result(self): web_ping = WebPing(timeout=3) url_field = URLField("test_ping", "title", "this is a test") result = WebPing.ping(url_field.to_python("http://127.0.0.1:" + str(self.web_server_port) + "/test_page"), timeout=3) out = StringIO() web_ping.output_result(result, "stanza", "title", unbroken=True, close=True, out=out) self.assertTrue(out.getvalue().find("response_code=200") >= 0)