You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <Catch/fakeit.hpp>
|
|
|
|
|
#include <SessionContext.hpp>
|
|
|
|
|
#include <ServerContext.hpp>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
SCENARIO("We are running a GET /session resource") {
|
|
|
|
|
auto torrent_session = TestSession();
|
|
|
|
|
auto response = std::make_shared<TestResponse>();
|
|
|
|
|
auto request = std::make_shared<TestRequest>();
|
|
|
|
|
GIVEN("the server is not working properly") {
|
|
|
|
|
AND_WHEN("we recive a request") {
|
|
|
|
|
tr::session::torrents::get(torrent_session, response, request);
|
|
|
|
|
THEN("the server should reply with service unavailable") {
|
|
|
|
|
CommonResponse::service_unavailable(response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
tr::session::get(torrent_session, response, request);
|
|
|
|
|
THEN("the server should reply with resource data") {
|
|
|
|
|
REQUIRE(response->string() == ok_data_paused);
|
|
|
|
|
reply_is_200_ok(response);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|