From 10f4189fd789daa4cda83019881e07e2efe35a21 Mon Sep 17 00:00:00 2001 From: chatlanin Date: Fri, 26 Jul 2024 11:16:28 +0300 Subject: [PATCH] fix void --- src/trs/trs.hpp | 2 +- tests/main.cpp | 56 +++++++++++++++++++++++++++++-------------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/trs/trs.hpp b/src/trs/trs.hpp index e4ab1f1..eadef58 100644 --- a/src/trs/trs.hpp +++ b/src/trs/trs.hpp @@ -161,7 +161,7 @@ namespace trs return r; } - static auto upload(std::string from, std::string to) + static void upload(std::string from, std::string to) { auto r = cpr::Get(cpr::Url(from)); diff --git a/tests/main.cpp b/tests/main.cpp index 6d6d889..8752c75 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -29,31 +29,41 @@ auto main(int argc, char* args[]) -> int // ATTENTION !!! // обязательно реализовать инициализацию БД - const std::string con = "postgres://chatlanin:password_for_connection_to_test_db@localhost:5423/test.db?sslmode=disable"; + // const std::string con = "postgres://chatlanin:password_for_connection_to_test_db@localhost:5423/test.db?sslmode=disable"; + // + // try + // { + // PGXX().init("con_1", 300, con); + // PGXX().init("con_2", 300, con); + // } + // catch(hack::exception& ex) + // { + // ex.log(); + // throw; + // } + // + // trs::client cli {"localhost:5000"}; + // cli.set_token("token"); + // trs::client cli_2 { std::move(cli) }; + // auto r1 = cli_2.post("func_name", trs::JSON{{ "key", "test message" }}); + // auto j = trs::JSON{{ "key", "test message" }}; + // auto r2 = cli_2.post("func_name", j); + // + // trs::client::upload("https://file-examples.com/storage/feaf4c715066a139295358c/2017/11/file_example_MP3_700KB.mp3", "/mnt/raid/projects/trs/test.mp3"); + // + // trs::server srv; + // srv.init("test service"); + // + // srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider); + // srv.run(); - try - { - PGXX().init("con_1", 300, con); - PGXX().init("con_2", 300, con); - } - catch(hack::exception& ex) - { - ex.log(); - throw; - } - trs::client cli {"localhost:5000"}; - cli.set_token("token"); - trs::client cli_2 { std::move(cli) }; - auto r1 = cli_2.post("func_name", trs::JSON{{ "key", "test message" }}); - auto j = trs::JSON{{ "key", "test message" }}; - auto r2 = cli_2.post("func_name", j); - trs::client::upload("https://file-examples.com/storage/feaf4c715066a139295358c/2017/11/file_example_MP3_700KB.mp3", "/mnt/raid/projects/trs/test.mp3"); - trs::server srv; - srv.init("test service"); - - srv.registration("healthcheck", worckspaces::inspector, worckspaces::provider); - srv.run(); + std::regex regex_pattern("https://.*\\.mp3"); + std::string url = "https://file-examples.com/storage/feaf4c715066a139295358c/2017/11/file_example_MP3_700KB.mp3"; + if (!std::regex_match(url, regex_pattern)) + { + hack::log()("error"); + } }