diff --git a/toREST/src/main.cxx b/toREST/src/main.cxx index 52ebbe6..85c4151 100644 --- a/toREST/src/main.cxx +++ b/toREST/src/main.cxx @@ -40,9 +40,12 @@ int main(int argc, char *argv[]) { tr::session::patch(session, resp, req); }; - http_server.resource["^/session/torrents(\\?.*)?\\/?$"]["GET"] = [&session](std::shared_ptr resp, std::shared_ptr req) { + http_server.resource["^/session/torrents(\\?.*)?\\/?$"]["GET"] = [&](std::shared_ptr resp, std::shared_ptr req) { tr::session::torrents::get(session, resp, req); }; + http_server.resource["^/session/torrents(\\?.*)?\\/?$"]["PATCH"] = [&](std::shared_ptr resp, std::shared_ptr req) { + + }; std::thread server_thread([&http_server]() { http_server.start(); diff --git a/toREST/tests/torrents_test.cpp b/toREST/tests/torrents_test.cpp index 3e6f32a..1c0da47 100644 --- a/toREST/tests/torrents_test.cpp +++ b/toREST/tests/torrents_test.cpp @@ -19,12 +19,12 @@ SCENARIO("We are running a GET /session/torrents resource") { } GIVEN("the server is working properly") { torrent_session.valid = true; - AND_WHEN("the session is paused the paused field is set to true") { - torrent_session.paused = true; + AND_WHEN("the session the session has no torrents") { tr::session::torrents::get(torrent_session, response, request); - THEN("the server should reply with resource data") { + THEN("the server should reply with an empty array") { CommonResponse::ok(response, {{"torrents", nlohmann::json::array()}}); } + } } } \ No newline at end of file