|
|
|
|
@ -89,9 +89,23 @@ SCENARIO("We are running a POST /session/torrents resource") {
|
|
|
|
|
{{"magnet_uri", magnet_uri}, |
|
|
|
|
{"save_path", "music"}}); |
|
|
|
|
tr::session::torrents::post(settings, torrent_session, response, request); |
|
|
|
|
THEN("the server should reply created") { |
|
|
|
|
CommonResponse::created(response, request, "/session/torrents/" + magnet_hash); |
|
|
|
|
REQUIRE(torrent_session.get_torrents().size() == 1); |
|
|
|
|
REQUIRE_FALSE(torrent_session.get_torrents()[0].status().paused); |
|
|
|
|
REQUIRE((torrent_session.get_torrents()[0]).status().save_path == "/music"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
GIVEN("we specify the torrent field to be paused") { |
|
|
|
|
request->content << nlohmann::json::object( |
|
|
|
|
{{"magnet_uri", magnet_uri}, |
|
|
|
|
{"save_path", "music"}, |
|
|
|
|
{"paused", "true"}}); |
|
|
|
|
THEN("the server should reply with bad request") { |
|
|
|
|
tr::session::torrents::post(settings, torrent_session, response, request); |
|
|
|
|
CommonResponse::created(response, request, "/session/torrents/" + magnet_hash); |
|
|
|
|
REQUIRE(torrent_session.get_torrents().size() == 1); |
|
|
|
|
REQUIRE(torrent_session.get_torrents()[0].status().paused); |
|
|
|
|
REQUIRE((torrent_session.get_torrents()[0]).status().save_path == "/music"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|