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.
30 lines
1.0 KiB
30 lines
1.0 KiB
|
9 years ago
|
#include <Catch/fakeit.hpp>
|
||
|
|
#include <ServerContext.hpp>
|
||
|
9 years ago
|
#include <SessionContext.hpp>
|
||
|
|
#include <torrents.hpp>
|
||
|
9 years ago
|
|
||
|
|
using namespace std;
|
||
|
|
|
||
|
9 years ago
|
SCENARIO("We are running a GET /session/torrents resource") {
|
||
|
9 years ago
|
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") {
|
||
|
9 years ago
|
tr::session::torrents::get(torrent_session, response, request);
|
||
|
9 years ago
|
THEN("the server should reply with service unavailable") {
|
||
|
9 years ago
|
CommonResponse::service_unavailable(response);
|
||
|
9 years ago
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
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;
|
||
|
9 years ago
|
tr::session::torrents::get(torrent_session, response, request);
|
||
|
9 years ago
|
THEN("the server should reply with resource data") {
|
||
|
9 years ago
|
CommonResponse::ok(response, {{"torrents", nlohmann::json::array()}});
|
||
|
9 years ago
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|