Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
get_test.cc
1 #include <gtest/gtest.h>
2 
3 #include <boost/process.hpp>
4 
5 #include "get.h"
6 #include "test_utils.h"
7 
8 static std::string server = "http://localhost:";
9 
10 TEST(aktualizr_get, good) {
11  Config config;
13  config.storage.path = dir.Path();
14 
15  std::vector<std::string> headers;
16  std::string body = aktualizrGet(config, server + "/path/1/2/3", headers);
17  EXPECT_EQ("{\"path\": \"/path/1/2/3\"}", body);
18 }
19 
20 #ifndef __NO_MAIN__
21 int main(int argc, char **argv) {
22  ::testing::InitGoogleTest(&argc, argv);
23 
24  std::string port = TestUtils::getFreePort();
25  server += port;
26  boost::process::child server_process("tests/fake_http_server/fake_test_server.py", port);
27  TestUtils::waitForServer(server + "/");
28  return RUN_ALL_TESTS();
29 }
30 #endif
Config
Configuration object for an aktualizr instance running on a Primary ECU.
Definition: config.h:208
TemporaryDirectory
Definition: utils.h:82