8
8
#include < boost/network/include/http/client.hpp>
9
9
#include < boost/test/unit_test.hpp>
10
10
#include " client_types.hpp"
11
+ #include " http_test_server.hpp"
11
12
12
- namespace http = boost::network::http;
13
+ struct localhost_server_fixture {
14
+ localhost_server_fixture () {
15
+ if (!server.start ())
16
+ std::cout << " Failed to start HTTP server for test!" << std::endl;
17
+ }
18
+
19
+ ~localhost_server_fixture () {
20
+ if (!server.stop ())
21
+ std::cout << " Failed to stop HTTP server for test!" << std::endl;
22
+ }
23
+
24
+ http_test_server server;
25
+ };
26
+
27
+ BOOST_GLOBAL_FIXTURE (localhost_server_fixture);
13
28
14
29
BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_1_0, client, client_types) {
15
30
typename client::request request (" http://localhost:12121/" );
@@ -22,11 +37,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_1_0, client, client_types) {
22
37
, std::exception );
23
38
}
24
39
25
- BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_with_options, client,
26
- client_types) {
27
- typename client::request request (
28
- " http://cznic.dl.sourceforge.net/project/boost/boost/1.55.0/"
29
- " boost_1_55_0.tar.bz2" );
40
+ BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test_timeout_with_options, client, client_types) {
41
+ typename client::request request (" http://localhost:8000/cgi-bin/sleep.py?3" );
30
42
typename client::response response;
31
43
typename client::options options;
32
44
client client_ (options.timeout (1 ));
@@ -37,10 +49,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout_with_options, client,
37
49
38
50
#ifdef BOOST_NETWORK_ENABLE_HTTPS
39
51
40
- BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_timeout_with_options, client,
41
- client_types) {
42
- typename client::request request (
43
- " https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.8.2.tar.bz2" );
52
+ BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_timeout_with_options, client, client_types) {
53
+ typename client::request request (" https://localhost:8000/cgi-bin/sleep.py?3" );
44
54
typename client::response response;
45
55
typename client::options options;
46
56
client client_ (options.timeout (1 ));
0 commit comments