Repository: mesos Updated Branches: refs/heads/master 077b29a21 -> f59e969a7
Revert "More basic call validation tests for HTTP API." This reverts commit 077b29a2197bc0376843bd62b03f6bdde4d3970d that was incorrectly committed before its dependency was committed. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d3588754 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d3588754 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d3588754 Branch: refs/heads/master Commit: d358875433b858d0b4b1b1f2f1e78eed6ddbc0b9 Parents: 077b29a Author: Vinod Kone <[email protected]> Authored: Fri Aug 7 10:53:13 2015 -0700 Committer: Vinod Kone <[email protected]> Committed: Fri Aug 7 10:53:13 2015 -0700 ---------------------------------------------------------------------- src/tests/http_api_tests.cpp | 79 --------------------------------------- 1 file changed, 79 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/d3588754/src/tests/http_api_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/http_api_tests.cpp b/src/tests/http_api_tests.cpp index e63a29d..57d7e74 100644 --- a/src/tests/http_api_tests.cpp +++ b/src/tests/http_api_tests.cpp @@ -52,7 +52,6 @@ using process::http::BadRequest; using process::http::OK; using process::http::Pipe; using process::http::Response; -using process::http::UnsupportedMediaType; using std::string; @@ -133,84 +132,6 @@ TEST_F(HttpApiTest, NoContentType) } -// This test sends a valid JSON blob that cannot be deserialized -// into a valid protobuf resulting in a BadRequest. -TEST_F(HttpApiTest, ValidJsonButInvalidProtobuf) -{ - Try<PID<Master>> master = StartMaster(); - ASSERT_SOME(master); - - JSON::Object object; - object.values["string"] = "valid_json"; - - hashmap<string, string> headers; - headers["Accept"] = APPLICATION_JSON; - - Future<Response> response = process::http::post( - master.get(), - "call", - headers, - stringify(object), - APPLICATION_JSON); - - AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response); -} - - -// This test sends a malformed body that cannot be deserialized -// into a valid protobuf resulting in a BadRequest. -TEST_P(HttpApiTest, MalformedContent) -{ - Try<PID<Master>> master = StartMaster(); - ASSERT_SOME(master); - - const std::string body = "MALFORMED_CONTENT"; - - const std::string contentType = GetParam(); - hashmap<string, string> headers; - headers["Accept"] = contentType; - - Future<Response> response = process::http::post( - master.get(), - "call", - headers, - body, - contentType); - - AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response); -} - - -// This test sets an unsupported media type as Content-Type. This -// should result in a 415 (UnsupportedMediaType) response. -TEST_P(HttpApiTest, UnsupportedContentMediaType) -{ - Try<PID<Master>> master = StartMaster(); - ASSERT_SOME(master); - - const std::string contentType = GetParam(); - hashmap<string, string> headers; - headers["Accept"] = contentType; - - Call call; - call.set_type(Call::SUBSCRIBE); - - Call::Subscribe* subscribe = call.mutable_subscribe(); - subscribe->mutable_framework_info()->CopyFrom(DEFAULT_FRAMEWORK_INFO); - - const std::string unknownMediaType = "application/unknown-media-type"; - - Future<Response> response = process::http::post( - master.get(), - "call", - headers, - serialize(call, contentType), - unknownMediaType); - - AWAIT_EXPECT_RESPONSE_STATUS_EQ(UnsupportedMediaType().status, response); -} - - // This test verifies if the scheduler is able to receive a Subscribed // event on the stream in response to a Subscribe call request. TEST_P(HttpApiTest, Subscribe)
