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.
29 lines
707 B
29 lines
707 B
|
9 years ago
|
#ifndef _TR_TEST_SERVER_CONTEXT_HPP_
|
||
|
|
#define _TR_TEST_SERVER_CONTEXT_HPP_
|
||
|
|
#include <sstream>
|
||
|
|
#include <memory>
|
||
|
|
#include <Catch/fakeit.hpp>
|
||
|
|
#include <json.hpp>
|
||
|
|
|
||
|
|
class TestRequest {
|
||
|
|
public:
|
||
|
|
std::stringstream content;
|
||
|
|
};
|
||
|
|
|
||
|
|
class TestResponse : public std::stringstream {
|
||
|
|
public:
|
||
|
|
std::string buffer;
|
||
|
|
std::string string();
|
||
|
|
std::string message();
|
||
|
|
std::string code();
|
||
|
|
};
|
||
|
|
|
||
|
|
class CommonResponse {
|
||
|
|
public:
|
||
|
|
static void service_unavailable(std::shared_ptr<TestResponse> response);
|
||
|
|
static void ok(std::shared_ptr<TestResponse> response, const nlohmann::json &data);
|
||
|
|
static void bad_request(std::shared_ptr<TestResponse> response);
|
||
|
|
static void accepted(std::shared_ptr<TestResponse> response);
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif
|