|
@@ -0,0 +1,97 @@
|
|
|
+#define CATCH_CONFIG_MAIN
|
|
|
+#include <catch2.hpp>
|
|
|
+#include "RestfulFunc.h"
|
|
|
+
|
|
|
+TEST_CASE("test http connected probe", "[probe1]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("http://mayun.itc.cmbchina.cn", msg) > 0);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http baidu probe", "[probe2]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://www.baidu.com/", msg) > 0);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http illgal format probe", "[probe3]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("", msg) == -3);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http illgal format probe 2", "[probe4]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("http", msg) == -3);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TEST_CASE("test http illgal format probe 3", "[probe5]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("99.12.23.78", msg) == -3);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http illgal format probe 4", "[probe6]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("55.4.33.22", msg) == -3);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http cmb format probe json", "[probe7]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://rvcgateway.paas.cmbchina.cn/health", msg) > 0);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http cmb format probe 2", "[probe8]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://tsaccess.paas.cmbchina.cn/tsas/detect", msg, -1) == -2);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http cmb format probe 3", "[probe9]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://uploadservice.paas.cmbchina.cn/rvc/detect", msg) > 0);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http cmb format probe 4", "[probe10]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://rvcterminal.paasst.cmbchina.cn/health", msg) > 0);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http github probe", "[probe11]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://github.com/gifur", msg) == -1);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("test http github with timeout probe", "[probe]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://github.com/gifur", msg) == -1);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+TEST_CASE("Test http probe protocols implement", "[normal]")
|
|
|
+{
|
|
|
+ std::string msg;
|
|
|
+ REQUIRE(HttpProbe("https://rvcgateway.paas.cmbchina.cn/health", msg) == 200);
|
|
|
+ std::cout << msg << std::endl;
|
|
|
+}
|
|
|
+
|
|
|
+
|