-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconnection_test.cc
34 lines (32 loc) · 1.1 KB
/
connection_test.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "gtest/gtest.h"
#include "connection.h"
#include "server.h"
#include <boost/asio.hpp>
TEST(connection, BasicTest) {
std::string addr = "127.0.0.1";
std::string port = "4000";
/*
std::vector<requestconfig> rc;
rc.push_back(requestconfig("/echo", "EchoHandler"));
rc.push_back(requestconfig("/echo", "EchoHandler"));
Team15::server::server server(addr, port, rc);
*/
NginxConfig config;
Team15::server::server server(addr, port, config);
Team15::server::connection con(boost::asio::ip::tcp::socket(server.getService()),&server);
}
/*
TEST(connection, BasicEchoTest) {
Team15::server::server server("127.0.0.1","4000");
Team15::server::connection con(boost::asio::ip::tcp::socket(server.getService()),&server);
std::string buff = "GET TEST";
con.setBuffer(buff);
con.generate_response();
HttpResponse* response = con.getResponse();
//checking the response
EXPECT_STREQ(response->getStatusCode().c_str(),"200");
EXPECT_STREQ(response->getReasoning().c_str(),"OK");
EXPECT_STREQ(response->getBody(),"GET TEST");
}
*/
//will test more with actual parsing logic. For now basic test.