You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2016/01/20 22:41:35 UTC
[2/4] mesos git commit: Removed HTTPTest.Auth test.
Removed HTTPTest.Auth test.
Manual HTTP authentication is being phased out in favor of the HTTP
authentication support built-in into libprocess, hence this test is no
longer necessary.
Review: https://reviews.apache.org/r/42143/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/17766711
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/17766711
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/17766711
Branch: refs/heads/master
Commit: 177667115d492cc8391cce748967649a5a1b8984
Parents: 51f05b1
Author: Alexander Rojas <al...@mesosphere.io>
Authored: Wed Jan 20 22:00:21 2016 +0100
Committer: Till Toenshoff <to...@me.com>
Committed: Wed Jan 20 22:00:21 2016 +0100
----------------------------------------------------------------------
3rdparty/libprocess/src/tests/http_tests.cpp | 52 -----------------------
1 file changed, 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/17766711/3rdparty/libprocess/src/tests/http_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/http_tests.cpp b/3rdparty/libprocess/src/tests/http_tests.cpp
index c23d0bf..7e1567f 100644
--- a/3rdparty/libprocess/src/tests/http_tests.cpp
+++ b/3rdparty/libprocess/src/tests/http_tests.cpp
@@ -89,7 +89,6 @@ public:
protected:
virtual void initialize()
{
- route("/auth", None(), &HttpProcess::auth);
route("/body", None(), &HttpProcess::body);
route("/pipe", None(), &HttpProcess::pipe);
route("/get", None(), &HttpProcess::get);
@@ -99,16 +98,6 @@ protected:
route("/a/b/c", None(), &HttpProcess::abc);
route("/authenticated", "realm", None(), &HttpProcess::authenticated);
}
-
- Future<http::Response> auth(const http::Request& request)
- {
- string encodedAuth = base64::encode("testuser:testpass");
- Option<string> authHeader = request.headers.get("Authorization");
- if (!authHeader.isSome() || (authHeader.get() != "Basic " + encodedAuth)) {
- return http::Unauthorized("testrealm");
- }
- return http::OK();
- }
};
@@ -132,47 +121,6 @@ public:
// TODO(vinod): Use AWAIT_EXPECT_RESPONSE_STATUS_EQ in the tests.
-TEST(HTTPTest, Auth)
-{
- Http http;
-
- // Test the case where there is no auth.
- Future<http::Response> noAuthFuture = http::get(http.process->self(), "auth");
-
- AWAIT_READY(noAuthFuture);
- EXPECT_EQ(http::Status::UNAUTHORIZED, noAuthFuture->code);
- EXPECT_EQ(http::Status::string(http::Status::UNAUTHORIZED),
- noAuthFuture->status);
- ASSERT_SOME_EQ("Basic realm=\"testrealm\"",
- noAuthFuture->headers.get("WWW-authenticate"));
-
- // Now test passing wrong auth header.
- http::Headers headers;
- headers["Authorization"] = "Basic " + base64::encode("testuser:wrongpass");
-
- Future<http::Response> wrongAuthFuture =
- http::get(http.process->self(), "auth", None(), headers);
-
- AWAIT_READY(wrongAuthFuture);
- EXPECT_EQ(http::Status::UNAUTHORIZED, wrongAuthFuture->code);
- EXPECT_EQ(http::Status::string(http::Status::UNAUTHORIZED),
- wrongAuthFuture->status);
-
- ASSERT_SOME_EQ("Basic realm=\"testrealm\"",
- wrongAuthFuture->headers.get("WWW-authenticate"));
-
- // Now test passing right auth header.
- headers["Authorization"] = "Basic " + base64::encode("testuser:testpass");
-
- Future<http::Response> rightAuthFuture =
- http::get(http.process->self(), "auth", None(), headers);
-
- AWAIT_READY(rightAuthFuture);
- EXPECT_EQ(http::Status::OK, rightAuthFuture->code);
- EXPECT_EQ(http::Status::string(http::Status::OK),
- rightAuthFuture->status);
-}
-
TEST(HTTPTest, Endpoints)
{