Skip to content

Commit af77702

Browse files
committed
Updates to some of the tests.
1 parent 3d0cc92 commit af77702

File tree

3 files changed

+13
-46
lines changed

3 files changed

+13
-46
lines changed

http/src/network/http/v2/client/response_parser.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Copyright (C) 2013 by Glyn Matthews
2-
// Copyright 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3-
// Copyright 2009-2012 Dean Michael Berris <dberris@google.com>.
4-
// Copyright 2012 Google, Inc.
5-
// Copyright 2009 Tarroo, Inc.
2+
// Copyright Dean Michael Berris 2010.
3+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
4+
// Copyright 2011 Google, Inc.
65
// Distributed under the Boost Software License, Version 1.0.
76
// (See accompanying file LICENSE_1_0.txt or copy at
87
// http://www.boost.org/LICENSE_1_0.txt)

http/test/v2/features/client/normal_connection_test.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ Describe(normal_http_connection) {
3030
It(connects_to_localhost) {
3131
// Resolve the host.
3232
boost::system::error_code ec;
33-
tcp::resolver::query query("127.0.0.1", "80");
33+
tcp::resolver::query query("www.boost.org", "80");
3434
auto it = resolver_->resolve(query, ec);
3535
Assert::That(ec, Equals(boost::system::error_code()));
3636

3737
// Make sure that the connection is successful.
3838
tcp::endpoint endpoint(it->endpoint());
39-
connection_->async_connect(endpoint, "127.0.0.1",
39+
connection_->async_connect(endpoint, "www.boost.org",
4040
[&ec] (const boost::system::error_code &ec_) {
4141
ec = ec_;
4242
});
@@ -47,19 +47,19 @@ Describe(normal_http_connection) {
4747
It(writes_to_localhost) {
4848
// Resolve the host.
4949
boost::system::error_code ec;
50-
tcp::resolver::query query("127.0.0.1", "80");
50+
tcp::resolver::query query("www.boost.org", "80");
5151
auto it = resolver_->resolve(query, ec);
5252
Assert::That(ec, Equals(boost::system::error_code()));
5353

5454
// Make sure that the connection is successful.
5555
tcp::endpoint endpoint(it->endpoint());
56-
connection_->async_connect(endpoint, "127.0.0.1",
56+
connection_->async_connect(endpoint, "www.boost.org",
5757
[&ec] (const boost::system::error_code &ec_) {
5858
Assert::That(ec_, Equals(boost::system::error_code()));
5959
});
6060

6161
// Create an HTTP request.
62-
http::request request{network::uri{"http://127.0.0.1/"}};
62+
http::request request{network::uri{"http://www.boost.org/"}};
6363
request.set_method(http::method::GET);
6464
request.set_version("1.0");
6565
request.append_header("User-Agent", "normal_connection_test");
@@ -83,19 +83,19 @@ Describe(normal_http_connection) {
8383
It(reads_from_localhost) {
8484
// Resolve the host.
8585
boost::system::error_code ec;
86-
tcp::resolver::query query("127.0.0.1", "80");
86+
tcp::resolver::query query("www.boost.org", "80");
8787
auto it = resolver_->resolve(query, ec);
8888
Assert::That(ec, Equals(boost::system::error_code()));
8989

9090
// Make sure that the connection is successful.
9191
tcp::endpoint endpoint(it->endpoint());
92-
connection_->async_connect(endpoint, "127.0.0.1",
92+
connection_->async_connect(endpoint, "www.boost.org",
9393
[] (const boost::system::error_code &ec_) {
9494
Assert::That(ec_, Equals(boost::system::error_code()));
9595
});
9696

9797
// Create an HTTP request.
98-
http::request request{network::uri{"http://127.0.0.1/"}};
98+
http::request request{network::uri{"http://www.boost.org/LICENSE_1_0.txt"}};
9999
request.set_method(http::method::GET);
100100
request.set_version("1.0");
101101
request.append_header("User-Agent", "normal_connection_test");
@@ -125,6 +125,7 @@ Describe(normal_http_connection) {
125125
});
126126

127127
io_service_->run();
128+
std::cout << output << std::endl;
128129
Assert::That(bytes_read, IsGreaterThan(0));
129130
}
130131

http/test/v2/units/client/response_parser_test.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -55,44 +55,11 @@ namespace {
5555

5656
TEST(response_parser_test, parse_version) {
5757
http::response_parser parser;
58-
auto part = parser.parse_until(http::response_parser::http_version_minor, input);
58+
auto part = parser.parse_until(http::response_parser::http_version_done, input);
5959
ASSERT_TRUE(std::get<0>(part));
6060
ASSERT_EQ("HTTP/1.0", trimmed_string(std::begin(std::get<1>(part)), std::end(std::get<1>(part))));
6161
}
6262

63-
TEST(response_parser_test, parse_version_major) {
64-
http::response_parser parser;
65-
auto part_1 = parser.parse_until(http::response_parser::http_version_slash, input);
66-
ASSERT_TRUE(std::get<0>(part_1));
67-
auto part_2 = parser.parse_until(http::response_parser::http_version_major,
68-
boost::make_iterator_range(std::end(std::get<1>(part_1)),
69-
std::end(input)));
70-
ASSERT_TRUE(std::get<0>(part_2));
71-
ASSERT_EQ("1", trimmed_string(std::begin(std::get<1>(part_2)), std::end(std::get<1>(part_2))));
72-
}
73-
74-
TEST(response_parser_test, parse_version_major_minor) {
75-
http::response_parser parser;
76-
auto part_1 = parser.parse_until(http::response_parser::http_version_slash, input);
77-
ASSERT_TRUE(std::get<0>(part_1));
78-
auto part_2 = parser.parse_until(http::response_parser::http_version_minor,
79-
boost::make_iterator_range(std::end(std::get<1>(part_1)),
80-
std::end(input)));
81-
ASSERT_TRUE(std::get<0>(part_2));
82-
ASSERT_EQ("1.0", trimmed_string(std::begin(std::get<1>(part_2)), std::end(std::get<1>(part_2))));
83-
}
84-
85-
TEST(response_parser_test, parse_status_digit) {
86-
http::response_parser parser;
87-
auto part_1 = parser.parse_until(http::response_parser::http_version_done, input);
88-
ASSERT_TRUE(std::get<0>(part_1));
89-
auto part_2 = parser.parse_until(http::response_parser::http_status_digit,
90-
boost::make_iterator_range(std::end(std::get<1>(part_1)),
91-
std::end(input)));
92-
ASSERT_TRUE(std::get<0>(part_2));
93-
ASSERT_EQ("2", trimmed_string(std::begin(std::get<1>(part_2)), std::end(std::get<1>(part_2))));
94-
}
95-
9663
TEST(response_parser_test, parse_status_code) {
9764
http::response_parser parser;
9865
auto part_1 = parser.parse_until(http::response_parser::http_version_done, input);

0 commit comments

Comments
 (0)