219 219 |
|
220 220 | #[allow(unreachable_code, unused_variables)]
|
221 221 | #[cfg(test)]
|
222 222 | mod json_unions_test {
|
223 223 |
|
224 224 | /// Serializes a string union value
|
225 225 | /// Test ID: RestJsonSerializeStringUnionValue
|
226 226 | #[::tokio::test]
|
227 227 | #[::tracing_test::traced_test]
|
228 228 | async fn rest_json_serialize_string_union_value_request() {
|
229 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
229 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
230 230 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
231 231 |
|
232 232 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
233 233 | let result = client
|
234 234 | .json_unions()
|
235 235 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::StringValue("foo".to_owned())))
|
236 236 | .send()
|
237 237 | .await;
|
238 238 | let _ = dbg!(result);
|
239 239 | let http_request = request_receiver.expect_request();
|
240 240 | let expected_headers = [("Content-Type", "application/json")];
|
241 241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
242 242 | let body = http_request.body().bytes().expect("body should be strict");
|
243 243 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
244 244 | body,
|
245 245 | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
246 246 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
247 247 | ));
|
248 248 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
249 249 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
250 250 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
251 251 | }
|
252 252 |
|
253 253 | /// Serializes a boolean union value
|
254 254 | /// Test ID: RestJsonSerializeBooleanUnionValue
|
255 255 | #[::tokio::test]
|
256 256 | #[::tracing_test::traced_test]
|
257 257 | async fn rest_json_serialize_boolean_union_value_request() {
|
258 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
258 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
259 259 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
260 260 |
|
261 261 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
262 262 | let result = client
|
263 263 | .json_unions()
|
264 264 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::BooleanValue(true)))
|
265 265 | .send()
|
266 266 | .await;
|
267 267 | let _ = dbg!(result);
|
268 268 | let http_request = request_receiver.expect_request();
|
269 269 | let expected_headers = [("Content-Type", "application/json")];
|
270 270 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
271 271 | let body = http_request.body().bytes().expect("body should be strict");
|
272 272 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
273 273 | body,
|
274 274 | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
275 275 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
276 276 | ));
|
277 277 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
278 278 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
279 279 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
280 280 | }
|
281 281 |
|
282 282 | /// Serializes a number union value
|
283 283 | /// Test ID: RestJsonSerializeNumberUnionValue
|
284 284 | #[::tokio::test]
|
285 285 | #[::tracing_test::traced_test]
|
286 286 | async fn rest_json_serialize_number_union_value_request() {
|
287 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
287 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
288 288 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
289 289 |
|
290 290 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
291 291 | let result = client
|
292 292 | .json_unions()
|
293 293 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::NumberValue(1)))
|
294 294 | .send()
|
295 295 | .await;
|
296 296 | let _ = dbg!(result);
|
297 297 | let http_request = request_receiver.expect_request();
|
298 298 | let expected_headers = [("Content-Type", "application/json")];
|
299 299 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
300 300 | let body = http_request.body().bytes().expect("body should be strict");
|
301 301 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
302 302 | body,
|
303 303 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
304 304 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
305 305 | ));
|
306 306 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
307 307 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
308 308 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
309 309 | }
|
310 310 |
|
311 311 | /// Serializes a blob union value
|
312 312 | /// Test ID: RestJsonSerializeBlobUnionValue
|
313 313 | #[::tokio::test]
|
314 314 | #[::tracing_test::traced_test]
|
315 315 | async fn rest_json_serialize_blob_union_value_request() {
|
316 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
316 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
317 317 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
318 318 |
|
319 319 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
320 320 | let result = client
|
321 321 | .json_unions()
|
322 322 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::BlobValue(
|
323 323 | ::aws_smithy_types::Blob::new("foo"),
|
324 324 | )))
|
325 325 | .send()
|
326 326 | .await;
|
327 327 | let _ = dbg!(result);
|
328 328 | let http_request = request_receiver.expect_request();
|
329 329 | let expected_headers = [("Content-Type", "application/json")];
|
330 330 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
331 331 | let body = http_request.body().bytes().expect("body should be strict");
|
332 332 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
333 333 | body,
|
334 334 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
335 335 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
336 336 | ));
|
337 337 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
338 338 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
339 339 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
340 340 | }
|
341 341 |
|
342 342 | /// Serializes a timestamp union value
|
343 343 | /// Test ID: RestJsonSerializeTimestampUnionValue
|
344 344 | #[::tokio::test]
|
345 345 | #[::tracing_test::traced_test]
|
346 346 | async fn rest_json_serialize_timestamp_union_value_request() {
|
347 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
347 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
348 348 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
349 349 |
|
350 350 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
351 351 | let result = client
|
352 352 | .json_unions()
|
353 353 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::TimestampValue(
|
354 354 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
355 355 | )))
|
356 356 | .send()
|
357 357 | .await;
|
358 358 | let _ = dbg!(result);
|
359 359 | let http_request = request_receiver.expect_request();
|
360 360 | let expected_headers = [("Content-Type", "application/json")];
|
361 361 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
362 362 | let body = http_request.body().bytes().expect("body should be strict");
|
363 363 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
364 364 | body,
|
365 365 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
366 366 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
367 367 | ));
|
368 368 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
369 369 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
370 370 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
371 371 | }
|
372 372 |
|
373 373 | /// Serializes an enum union value
|
374 374 | /// Test ID: RestJsonSerializeEnumUnionValue
|
375 375 | #[::tokio::test]
|
376 376 | #[::tracing_test::traced_test]
|
377 377 | async fn rest_json_serialize_enum_union_value_request() {
|
378 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
378 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
379 379 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
380 380 |
|
381 381 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
382 382 | let result = client
|
383 383 | .json_unions()
|
384 384 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::EnumValue(
|
385 385 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
386 386 | )))
|
387 387 | .send()
|
388 388 | .await;
|
389 389 | let _ = dbg!(result);
|
390 390 | let http_request = request_receiver.expect_request();
|
391 391 | let expected_headers = [("Content-Type", "application/json")];
|
392 392 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
393 393 | let body = http_request.body().bytes().expect("body should be strict");
|
394 394 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
395 395 | body,
|
396 396 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
397 397 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
398 398 | ));
|
399 399 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
400 400 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
401 401 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
402 402 | }
|
403 403 |
|
404 404 | /// Serializes a list union value
|
405 405 | /// Test ID: RestJsonSerializeListUnionValue
|
406 406 | #[::tokio::test]
|
407 407 | #[::tracing_test::traced_test]
|
408 408 | async fn rest_json_serialize_list_union_value_request() {
|
409 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
409 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
410 410 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
411 411 |
|
412 412 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
413 413 | let result = client
|
414 414 | .json_unions()
|
415 415 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::ListValue(vec![
|
416 416 | "foo".to_owned(),
|
417 417 | "bar".to_owned(),
|
418 418 | ])))
|
419 419 | .send()
|
420 420 | .await;
|
421 421 | let _ = dbg!(result);
|
422 422 | let http_request = request_receiver.expect_request();
|
423 423 | let expected_headers = [("Content-Type", "application/json")];
|
424 424 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
425 425 | let body = http_request.body().bytes().expect("body should be strict");
|
426 426 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
427 427 | body,
|
428 428 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
429 429 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
430 430 | ));
|
431 431 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
432 432 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
433 433 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
434 434 | }
|
435 435 |
|
436 436 | /// Serializes a map union value
|
437 437 | /// Test ID: RestJsonSerializeMapUnionValue
|
438 438 | #[::tokio::test]
|
439 439 | #[::tracing_test::traced_test]
|
440 440 | async fn rest_json_serialize_map_union_value_request() {
|
441 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
441 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
442 442 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
443 443 |
|
444 444 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
445 445 | let result = client
|
446 446 | .json_unions()
|
447 447 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::MapValue({
|
448 448 | let mut ret = ::std::collections::HashMap::new();
|
449 449 | ret.insert("foo".to_owned(), "bar".to_owned());
|
450 450 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
451 451 | ret
|
452 452 | })))
|
453 453 | .send()
|
454 454 | .await;
|
455 455 | let _ = dbg!(result);
|
456 456 | let http_request = request_receiver.expect_request();
|
457 457 | let expected_headers = [("Content-Type", "application/json")];
|
458 458 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
459 459 | let body = http_request.body().bytes().expect("body should be strict");
|
460 460 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
461 461 | body,
|
462 462 | "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}",
|
463 463 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
464 464 | ));
|
465 465 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
466 466 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
467 467 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
468 468 | }
|
469 469 |
|
470 470 | /// Serializes a structure union value
|
471 471 | /// Test ID: RestJsonSerializeStructureUnionValue
|
472 472 | #[::tokio::test]
|
473 473 | #[::tracing_test::traced_test]
|
474 474 | async fn rest_json_serialize_structure_union_value_request() {
|
475 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
475 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
476 476 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
477 477 |
|
478 478 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
479 479 | let result = client
|
480 480 | .json_unions()
|
481 481 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
|
482 482 | crate::types::GreetingStruct::builder()
|
483 483 | .set_hi(::std::option::Option::Some("hello".to_owned()))
|
484 484 | .build(),
|
485 485 | )))
|
486 486 | .send()
|
487 487 | .await;
|
488 488 | let _ = dbg!(result);
|
489 489 | let http_request = request_receiver.expect_request();
|
490 490 | let expected_headers = [("Content-Type", "application/json")];
|
491 491 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
492 492 | let body = http_request.body().bytes().expect("body should be strict");
|
493 493 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
494 494 | body,
|
495 495 | "{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}",
|
496 496 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
497 497 | ));
|
498 498 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
499 499 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
500 500 | ::pretty_assertions::assert_eq!(uri.path(), "/JsonUnions", "path was incorrect");
|
501 501 | }
|
502 502 |
|
503 503 | /// Serializes a renamed structure union value
|
504 504 | /// Test ID: RestJsonSerializeRenamedStructureUnionValue
|
505 505 | #[::tokio::test]
|
506 506 | #[::tracing_test::traced_test]
|
507 507 | async fn rest_json_serialize_renamed_structure_union_value_request() {
|
508 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
508 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
509 509 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
510 510 |
|
511 511 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
512 512 | let result = client
|
513 513 | .json_unions()
|
514 514 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::RenamedStructureValue(
|
515 515 | crate::types::RenamedGreeting::builder()
|
516 516 | .set_salutation(::std::option::Option::Some("hello!".to_owned()))
|
517 517 | .build(),
|
518 518 | )))
|