222 222 |
|
223 223 | #[allow(unreachable_code, unused_variables)]
|
224 224 | #[cfg(test)]
|
225 225 | mod sparse_json_maps_test {
|
226 226 |
|
227 227 | /// Serializes JSON maps
|
228 228 | /// Test ID: RestJsonSparseJsonMaps
|
229 229 | #[::tokio::test]
|
230 230 | #[::tracing_test::traced_test]
|
231 231 | async fn rest_json_sparse_json_maps_request() {
|
232 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
232 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
233 233 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
234 234 |
|
235 235 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
236 236 | let result = client
|
237 237 | .sparse_json_maps()
|
238 238 | .set_sparse_struct_map(::std::option::Option::Some({
|
239 239 | let mut ret = ::std::collections::HashMap::new();
|
240 240 | ret.insert(
|
241 241 | "foo".to_owned(),
|
242 242 | ::std::option::Option::Some(
|
243 243 | crate::types::GreetingStruct::builder()
|
244 244 | .set_hi(::std::option::Option::Some("there".to_owned()))
|
245 245 | .build(),
|
246 246 | ),
|
247 247 | );
|
248 248 | ret.insert(
|
249 249 | "baz".to_owned(),
|
250 250 | ::std::option::Option::Some(
|
251 251 | crate::types::GreetingStruct::builder()
|
252 252 | .set_hi(::std::option::Option::Some("bye".to_owned()))
|
253 253 | .build(),
|
254 254 | ),
|
255 255 | );
|
256 256 | ret
|
257 257 | }))
|
258 258 | .send()
|
259 259 | .await;
|
260 260 | let _ = dbg!(result);
|
261 261 | let http_request = request_receiver.expect_request();
|
262 262 | let expected_headers = [("Content-Type", "application/json")];
|
263 263 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
264 264 | let body = http_request.body().bytes().expect("body should be strict");
|
265 265 | ::aws_smithy_protocol_test::assert_ok(
|
266 266 | ::aws_smithy_protocol_test::validate_body(body, "{\n \"sparseStructMap\": {\n \"foo\": {\n \"hi\": \"there\"\n },\n \"baz\": {\n \"hi\": \"bye\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
267 267 | );
|
268 268 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
269 269 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
270 270 | ::pretty_assertions::assert_eq!(uri.path(), "/SparseJsonMaps", "path was incorrect");
|
271 271 | }
|
272 272 |
|
273 273 | /// Serializes JSON map values in sparse maps
|
274 274 | /// Test ID: RestJsonSerializesSparseNullMapValues
|
275 275 | #[::tokio::test]
|
276 276 | #[::tracing_test::traced_test]
|
277 277 | async fn rest_json_serializes_sparse_null_map_values_request() {
|
278 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
278 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
279 279 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
280 280 |
|
281 281 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
282 282 | let result = client
|
283 283 | .sparse_json_maps()
|
284 284 | .set_sparse_boolean_map(::std::option::Option::Some({
|
285 285 | let mut ret = ::std::collections::HashMap::new();
|
286 286 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
287 287 | ret
|
288 288 | }))
|
289 289 | .set_sparse_number_map(::std::option::Option::Some({
|
290 290 | let mut ret = ::std::collections::HashMap::new();
|
291 291 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
292 292 | ret
|
293 293 | }))
|
294 294 | .set_sparse_string_map(::std::option::Option::Some({
|
295 295 | let mut ret = ::std::collections::HashMap::new();
|
296 296 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
297 297 | ret
|
298 298 | }))
|
299 299 | .set_sparse_struct_map(::std::option::Option::Some({
|
300 300 | let mut ret = ::std::collections::HashMap::new();
|
301 301 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
302 302 | ret
|
303 303 | }))
|
304 304 | .send()
|
305 305 | .await;
|
306 306 | let _ = dbg!(result);
|
307 307 | let http_request = request_receiver.expect_request();
|
308 308 | let expected_headers = [("Content-Type", "application/json")];
|
309 309 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
310 310 | let body = http_request.body().bytes().expect("body should be strict");
|
311 311 | ::aws_smithy_protocol_test::assert_ok(
|
312 312 | ::aws_smithy_protocol_test::validate_body(body, "{\n \"sparseBooleanMap\": {\n \"x\": null\n },\n \"sparseNumberMap\": {\n \"x\": null\n },\n \"sparseStringMap\": {\n \"x\": null\n },\n \"sparseStructMap\": {\n \"x\": null\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
313 313 | );
|
314 314 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
315 315 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
316 316 | ::pretty_assertions::assert_eq!(uri.path(), "/SparseJsonMaps", "path was incorrect");
|
317 317 | }
|
318 318 |
|
319 319 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
320 320 | /// Test ID: RestJsonSerializesZeroValuesInSparseMaps
|
321 321 | #[::tokio::test]
|
322 322 | #[::tracing_test::traced_test]
|
323 323 | async fn rest_json_serializes_zero_values_in_sparse_maps_request() {
|
324 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
324 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
325 325 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
326 326 |
|
327 327 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
328 328 | let result = client
|
329 329 | .sparse_json_maps()
|
330 330 | .set_sparse_number_map(::std::option::Option::Some({
|
331 331 | let mut ret = ::std::collections::HashMap::new();
|
332 332 | ret.insert("x".to_owned(), ::std::option::Option::Some(0));
|
333 333 | ret
|
334 334 | }))
|
335 335 | .set_sparse_boolean_map(::std::option::Option::Some({
|
336 336 | let mut ret = ::std::collections::HashMap::new();
|
337 337 | ret.insert("x".to_owned(), ::std::option::Option::Some(false));
|
338 338 | ret
|
339 339 | }))
|
340 340 | .send()
|
341 341 | .await;
|
342 342 | let _ = dbg!(result);
|
343 343 | let http_request = request_receiver.expect_request();
|
344 344 | let expected_headers = [("Content-Type", "application/json")];
|
345 345 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
346 346 | let body = http_request.body().bytes().expect("body should be strict");
|
347 347 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
348 348 | body,
|
349 349 | "{\n \"sparseNumberMap\": {\n \"x\": 0\n },\n \"sparseBooleanMap\": {\n \"x\": false\n }\n}",
|
350 350 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
351 351 | ));
|
352 352 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
353 353 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
354 354 | ::pretty_assertions::assert_eq!(uri.path(), "/SparseJsonMaps", "path was incorrect");
|
355 355 | }
|
356 356 |
|
357 357 | /// A request that contains a sparse map of sets
|
358 358 | /// Test ID: RestJsonSerializesSparseSetMap
|
359 359 | #[::tokio::test]
|
360 360 | #[::tracing_test::traced_test]
|
361 361 | async fn rest_json_serializes_sparse_set_map_request() {
|
362 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
362 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
363 363 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
364 364 |
|
365 365 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
366 366 | let result = client
|
367 367 | .sparse_json_maps()
|
368 368 | .set_sparse_set_map(::std::option::Option::Some({
|
369 369 | let mut ret = ::std::collections::HashMap::new();
|
370 370 | ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
|
371 371 | ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
|
372 372 | ret
|
373 373 | }))
|
374 374 | .send()
|
375 375 | .await;
|
376 376 | let _ = dbg!(result);
|
377 377 | let http_request = request_receiver.expect_request();
|
378 378 | let expected_headers = [("Content-Type", "application/json")];
|
379 379 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
380 380 | let body = http_request.body().bytes().expect("body should be strict");
|
381 381 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
382 382 | body,
|
383 383 | "{\n \"sparseSetMap\": {\n \"x\": [],\n \"y\": [\"a\", \"b\"]\n }\n}",
|
384 384 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
385 385 | ));
|
386 386 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
387 387 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
388 388 | ::pretty_assertions::assert_eq!(uri.path(), "/SparseJsonMaps", "path was incorrect");
|
389 389 | }
|
390 390 |
|
391 391 | /// A request that contains a sparse map of sets.
|
392 392 | /// Test ID: RestJsonSerializesSparseSetMapAndRetainsNull
|
393 393 | #[::tokio::test]
|
394 394 | #[::tracing_test::traced_test]
|
395 395 | async fn rest_json_serializes_sparse_set_map_and_retains_null_request() {
|
396 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
396 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
397 397 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
398 398 |
|
399 399 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
400 400 | let result = client
|
401 401 | .sparse_json_maps()
|
402 402 | .set_sparse_set_map(::std::option::Option::Some({
|
403 403 | let mut ret = ::std::collections::HashMap::new();
|
404 404 | ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
|
405 405 | ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
|
406 406 | ret.insert("z".to_owned(), ::std::option::Option::None);
|