Browse Source

Missleading naming of method

master
Jørgen Lien Sellæg 9 years ago
parent
commit
c29f16e005
  1. 12
      toREST/tests/stubs/ServerContext.cpp
  2. 2
      toREST/tests/torrents_test.cpp

12
toREST/tests/stubs/ServerContext.cpp

@ -62,7 +62,7 @@ void header_present(std::shared_ptr<TestResponse> response, const std::string &h
REQUIRE(loc_itr->first == header); REQUIRE(loc_itr->first == header);
} }
void is_json_request(std::shared_ptr<TestResponse> response) { void is_json_response(std::shared_ptr<TestResponse> response) {
const auto content = response->content(); const auto content = response->content();
auto obj = nlohmann::json::parse(content); auto obj = nlohmann::json::parse(content);
REQUIRE(obj.is_object()); REQUIRE(obj.is_object());
@ -73,7 +73,7 @@ void is_json_request(std::shared_ptr<TestResponse> response) {
void CommonResponse::service_unavailable(std::shared_ptr<TestResponse> response) { void CommonResponse::service_unavailable(std::shared_ptr<TestResponse> response) {
REQUIRE(response->code() == "503"); REQUIRE(response->code() == "503");
REQUIRE(response->message() == "Service Unavailable"); REQUIRE(response->message() == "Service Unavailable");
is_json_request(response); is_json_response(response);
}; };
void CommonResponse::ok(std::shared_ptr<TestResponse> response, const nlohmann::json &data) { void CommonResponse::ok(std::shared_ptr<TestResponse> response, const nlohmann::json &data) {
@ -81,7 +81,7 @@ void CommonResponse::ok(std::shared_ptr<TestResponse> response, const nlohmann::
REQUIRE(response->code() == "200"); REQUIRE(response->code() == "200");
REQUIRE(response->message() == "OK"); REQUIRE(response->message() == "OK");
REQUIRE(response->content() == data_dump); REQUIRE(response->content() == data_dump);
is_json_request(response); is_json_response(response);
}; };
void CommonResponse::no_content(std::shared_ptr<TestResponse> response) { void CommonResponse::no_content(std::shared_ptr<TestResponse> response) {
@ -93,17 +93,17 @@ void CommonResponse::no_content(std::shared_ptr<TestResponse> response) {
void CommonResponse::bad_request(std::shared_ptr<TestResponse> response) { void CommonResponse::bad_request(std::shared_ptr<TestResponse> response) {
REQUIRE(response->code() == "400"); REQUIRE(response->code() == "400");
REQUIRE(response->message() == "Bad Request"); REQUIRE(response->message() == "Bad Request");
is_json_request(response); is_json_response(response);
}; };
void CommonResponse::accepted(std::shared_ptr<TestResponse> response) { void CommonResponse::accepted(std::shared_ptr<TestResponse> response) {
REQUIRE(response->code() == "202"); REQUIRE(response->code() == "202");
REQUIRE(response->message() == "Accepted"); REQUIRE(response->message() == "Accepted");
is_json_request(response); is_json_response(response);
}; };
void CommonResponse::created(std::shared_ptr<TestResponse> response, std::shared_ptr<TestRequest> request, const std::string &location) { void CommonResponse::created(std::shared_ptr<TestResponse> response, std::shared_ptr<TestRequest> request, const std::string &location) {
REQUIRE(response->code() == "201"); REQUIRE(response->code() == "201");
REQUIRE(response->message() == "Created"); REQUIRE(response->message() == "Created");
is_json_request(response); is_json_response(response);
header_present(response, "Location", location); header_present(response, "Location", location);
}; };

2
toREST/tests/torrents_test.cpp

@ -71,7 +71,7 @@ SCENARIO("We are running a POST /session/torrents resource") {
torrent_session.valid = true; torrent_session.valid = true;
WHEN("we recive a valid request") { WHEN("we recive a valid request") {
GIVEN("we use the default download directory") { GIVEN("we use the default download directory") {
AND_WHEN("we fill the magnet uri field"){ AND_WHEN("we fill the magnet uri field") {
THEN("the server should reply with created") { THEN("the server should reply with created") {
request->content << nlohmann::json::object({{"magnet_uri", magnet_uri}}); request->content << nlohmann::json::object({{"magnet_uri", magnet_uri}});
tr::session::torrents::post(settings, torrent_session, response, request); tr::session::torrents::post(settings, torrent_session, response, request);

Loading…
Cancel
Save