MCPcopy Create free account
hub / github.com/apache/mesos / TEST_P

Function TEST_P

src/tests/resource_provider_manager_tests.cpp:167–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167TEST_P(ResourceProviderManagerHttpApiTest, MalformedContent)
168{
169 const ContentType contentType = GetParam();
170
171 http::Request request;
172 request.method = "POST";
173 request.headers = createBasicAuthHeaders(DEFAULT_CREDENTIAL);
174 request.headers["Accept"] = stringify(contentType);
175 request.headers["Content-Type"] = stringify(contentType);
176 request.body = "MALFORMED_CONTENT";
177
178 ResourceProviderManager manager(
179 Registrar::create(Owned<Storage>(new InMemoryStorage)).get());
180
181 Future<http::Response> response = manager.api(request, None());
182
183 AWAIT_EXPECT_RESPONSE_STATUS_EQ(BadRequest().status, response);
184 switch (contentType) {
185 case ContentType::PROTOBUF:
186 AWAIT_EXPECT_RESPONSE_BODY_EQ(
187 "Failed to parse body into Call protobuf",
188 response);
189 break;
190 case ContentType::JSON:
191 AWAIT_EXPECT_RESPONSE_BODY_EQ(
192 "Failed to parse body into JSON: "
193 "syntax error at line 1 near: MALFORMED_CONTENT",
194 response);
195 break;
196 case ContentType::RECORDIO:
197 break;
198 }
199}
200
201
202// Confirm that the resource provider manager performs call validation

Callers

nothing calls this directly

Calls 15

createBasicAuthHeadersFunction · 0.85
NoneClass · 0.85
BadRequestClass · 0.85
OKClass · 0.85
createUUIDFunction · 0.85
AcceptedClass · 0.85
createDiskResourceFunction · 0.85
createDiskSourceRawFunction · 0.85
SomeFunction · 0.85
createEndpointDetectorFunction · 0.85

Tested by

no test coverage detected