Пример #1
0
#include <catch.hpp>
#include <response.hpp>

#define CRLF "\r\n"

using namespace std;
using namespace http::header_fields;

///////////////////////////////////////////////////////////////////////////////
TEST_CASE("Default constructor only creates status line", "[Response]") {
  http::Response response;
  //-------------------------
  string test_string = "HTTP/1.1 200 OK" CRLF CRLF;
  //-------------------------
  REQUIRE(test_string == response.to_string());
}

///////////////////////////////////////////////////////////////////////////////
TEST_CASE("Get status code", "[Response]") {
  http::Response response;
  //-------------------------
  REQUIRE(response.status_code() == http::status_t::OK);
}

///////////////////////////////////////////////////////////////////////////////
SCENARIO("Given a Response object") {
   http::Response response;
   //-------------------------
   WHEN("We set it's status code") {
    response.set_status_code(http::status_t::Not_Found);