12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #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;
- }
|