123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #define CATCH_CONFIG_MAIN
- #include <catch2.hpp>
- #include "RestfulFunc.h"
- TEST_CASE("test api manage", "[restful]")
- {
- HttpClientRequestConfig config("https://rvcgateway.paasst.cmbchina.cn/terminal");
- HttpClientResponseResult result;
- config.SetChildUri("/api/manage/regist/7555980103");
- RestfulClient client = RestfulClient::getInstance();
- client.Do(&config, &result, NULL);
- std::cout << result.content << std::endl;
- REQUIRE(!result.content.empty());
- }
- TEST_CASE("test api stage get api", "[restful]")
- {
- HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn");
- HttpClientResponseResult result;
- config.SetChildUri("/api/stage");
- config.AppendQuery("terminalNo", "7555980001");
- RestfulClient client = RestfulClient::getInstance();
- client.Do(&config, &result, NULL);
- std::cout << result.content << std::endl;
- REQUIRE(!result.content.empty());
- }
- TEST_CASE("test api stage post api", "[restful]")
- {
- HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn");
- config.SetRequestType(HttpRequestMethod::POST);
- config.SetChildUri("/api/stage");
- config.SetJsonBody("{\"terminalNo\":\"7555980001\", \"errEntityList\":\"566666\"}");
- RestfulClient client = RestfulClient::getInstance();
- HttpClientResponseResult result;
- client.Do(&config, &result, NULL);
- std::cout << result.content << std::endl;
- REQUIRE(!result.content.empty());
- }
- TEST_CASE("test api stage upload api", "[restful]")
- {
- HttpClientUploadRequest config("http://55.6.78.29:8080");
- config.SetChildUri("/api/upload/file");
- config.SetDefaultParam("{\"branch_no\":\"755\",\"file_head_custom\":\"\",\"file_name\":\"20220301.log\",\"file_path\":\"/home/rvc/dbg/mod_initiativetransfer/20220301.log\",\"file_type\":\"O\",\"first_file_length\":\"105116\",\"last_file_length\":\"\",\"plan_id\":\"dbg\",\"system_type\":\"L\",\"terminal_no\":\"7555980012\",\"upload_length\":\"0\"}");
- config.AddFiles("/home/rvc/dbg/mod_initiativetransfer/20220301.log");
- RestfulClient client = RestfulClient::getInstance();
- HttpClientResponseResult result;
- config.PreDo();
- client.Do(&config, &result, NULL);
- std::cout << result.content << std::endl;
- REQUIRE(!result.content.empty());
- }
|