$darkmode
server_test.cpp File Reference
#include <gtest/gtest.h>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <array>
#include <cstdio>
#include <memory>
#include <stdexcept>
#include <cloe/registrar.hpp>
#include <fable/utility/gtest.hpp>
#include <oak/registrar.hpp>
#include <oak/server.hpp>
#include "curl.hpp"
Include dependency graph for server_test.cpp:

Classes

class  Environment
 

Functions

std::string exec (const char *cmd)
 
std::string exec (const std::string &cmd)
 
std::string exec (const oak::Curl &curl)
 
std::unique_ptr< oak::Servercreate_server ()
 
 TEST (oak_server, listen)
 
 TEST (oak_server, fail_not_listening)
 
 TEST (oak_server, get_nohandler)
 
 TEST (oak_server, get_handler)
 
 TEST (oak_server, post_handler)
 Tries to POST to an endpoint which echos the data back.
 

Variables

std::string address
 
std::atomic< unsigned short > port
 
testing::Environment *const foo_env = testing::AddGlobalTestEnvironment(new Environment)
 

Detailed Description

See also
oak/server_test.hpp

Function Documentation

◆ exec()

std::string exec ( const char *  cmd)

Executes a (shell) command and return the StdOut

◆ TEST() [1/4]

TEST ( oak_server  ,
fail_not_listening   
)

Test that stopping a not-listening server results in an exception.

Here is the call graph for this function:

◆ TEST() [2/4]

TEST ( oak_server  ,
get_handler   
)

Try to GET an endpoint.

◆ TEST() [3/4]

TEST ( oak_server  ,
get_nohandler   
)

Try to GET a non-existing endpoint.

◆ TEST() [4/4]

TEST ( oak_server  ,
listen   
)

Try to create a server.