236 236 | mod json_unions_test {
|
237 237 |
|
238 238 | /// Serializes a string union value
|
239 239 | /// Test ID: AwsJson10SerializeStringUnionValue
|
240 240 | #[::tokio::test]
|
241 241 | #[::tracing_test::traced_test]
|
242 242 | async fn aws_json10_serialize_string_union_value_request() {
|
243 243 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
244 244 | let config_builder = crate::config::Config::builder()
|
245 245 | .with_test_defaults()
|
246 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
246 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
247 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
248 + | .allow_no_auth()
|
247 249 | .endpoint_url("https://example.com");
|
248 250 |
|
249 251 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
250 252 | let result = client
|
251 253 | .json_unions()
|
252 254 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::StringValue("foo".to_owned())))
|
253 255 | .send()
|
254 256 | .await;
|
255 257 | let _ = dbg!(result);
|
256 258 | let http_request = request_receiver.expect_request();
|
257 259 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
258 260 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
259 261 | let body = http_request.body().bytes().expect("body should be strict");
|
260 262 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
261 263 | body,
|
262 264 | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
263 265 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
264 266 | ));
|
265 267 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
266 268 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
267 269 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
268 270 | }
|
269 271 |
|
270 272 | /// Serializes a boolean union value
|
271 273 | /// Test ID: AwsJson10SerializeBooleanUnionValue
|
272 274 | #[::tokio::test]
|
273 275 | #[::tracing_test::traced_test]
|
274 276 | async fn aws_json10_serialize_boolean_union_value_request() {
|
275 277 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
276 278 | let config_builder = crate::config::Config::builder()
|
277 279 | .with_test_defaults()
|
278 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
280 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
281 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
282 + | .allow_no_auth()
|
279 283 | .endpoint_url("https://example.com");
|
280 284 |
|
281 285 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
282 286 | let result = client
|
283 287 | .json_unions()
|
284 288 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::BooleanValue(true)))
|
285 289 | .send()
|
286 290 | .await;
|
287 291 | let _ = dbg!(result);
|
288 292 | let http_request = request_receiver.expect_request();
|
289 293 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
290 294 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
291 295 | let body = http_request.body().bytes().expect("body should be strict");
|
292 296 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
293 297 | body,
|
294 298 | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
295 299 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
296 300 | ));
|
297 301 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
298 302 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
299 303 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
300 304 | }
|
301 305 |
|
302 306 | /// Serializes a number union value
|
303 307 | /// Test ID: AwsJson10SerializeNumberUnionValue
|
304 308 | #[::tokio::test]
|
305 309 | #[::tracing_test::traced_test]
|
306 310 | async fn aws_json10_serialize_number_union_value_request() {
|
307 311 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
308 312 | let config_builder = crate::config::Config::builder()
|
309 313 | .with_test_defaults()
|
310 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
314 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
315 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
316 + | .allow_no_auth()
|
311 317 | .endpoint_url("https://example.com");
|
312 318 |
|
313 319 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
314 320 | let result = client
|
315 321 | .json_unions()
|
316 322 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::NumberValue(1)))
|
317 323 | .send()
|
318 324 | .await;
|
319 325 | let _ = dbg!(result);
|
320 326 | let http_request = request_receiver.expect_request();
|
321 327 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
322 328 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
323 329 | let body = http_request.body().bytes().expect("body should be strict");
|
324 330 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
325 331 | body,
|
326 332 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
327 333 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
328 334 | ));
|
329 335 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
330 336 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
331 337 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
332 338 | }
|
333 339 |
|
334 340 | /// Serializes a blob union value
|
335 341 | /// Test ID: AwsJson10SerializeBlobUnionValue
|
336 342 | #[::tokio::test]
|
337 343 | #[::tracing_test::traced_test]
|
338 344 | async fn aws_json10_serialize_blob_union_value_request() {
|
339 345 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
340 346 | let config_builder = crate::config::Config::builder()
|
341 347 | .with_test_defaults()
|
342 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
348 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
349 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
350 + | .allow_no_auth()
|
343 351 | .endpoint_url("https://example.com");
|
344 352 |
|
345 353 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
346 354 | let result = client
|
347 355 | .json_unions()
|
348 356 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::BlobValue(
|
349 357 | ::aws_smithy_types::Blob::new("foo"),
|
350 358 | )))
|
351 359 | .send()
|
352 360 | .await;
|
353 361 | let _ = dbg!(result);
|
354 362 | let http_request = request_receiver.expect_request();
|
355 363 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
356 364 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
357 365 | let body = http_request.body().bytes().expect("body should be strict");
|
358 366 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
359 367 | body,
|
360 368 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
361 369 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
362 370 | ));
|
363 371 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
364 372 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
365 373 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
366 374 | }
|
367 375 |
|
368 376 | /// Serializes a timestamp union value
|
369 377 | /// Test ID: AwsJson10SerializeTimestampUnionValue
|
370 378 | #[::tokio::test]
|
371 379 | #[::tracing_test::traced_test]
|
372 380 | async fn aws_json10_serialize_timestamp_union_value_request() {
|
373 381 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
374 382 | let config_builder = crate::config::Config::builder()
|
375 383 | .with_test_defaults()
|
376 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
384 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
385 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
386 + | .allow_no_auth()
|
377 387 | .endpoint_url("https://example.com");
|
378 388 |
|
379 389 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
380 390 | let result = client
|
381 391 | .json_unions()
|
382 392 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::TimestampValue(
|
383 393 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
384 394 | )))
|
385 395 | .send()
|
386 396 | .await;
|
387 397 | let _ = dbg!(result);
|
388 398 | let http_request = request_receiver.expect_request();
|
389 399 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
390 400 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
391 401 | let body = http_request.body().bytes().expect("body should be strict");
|
392 402 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
393 403 | body,
|
394 404 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
395 405 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
396 406 | ));
|
397 407 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
398 408 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
399 409 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
400 410 | }
|
401 411 |
|
402 412 | /// Serializes an enum union value
|
403 413 | /// Test ID: AwsJson10SerializeEnumUnionValue
|
404 414 | #[::tokio::test]
|
405 415 | #[::tracing_test::traced_test]
|
406 416 | async fn aws_json10_serialize_enum_union_value_request() {
|
407 417 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
408 418 | let config_builder = crate::config::Config::builder()
|
409 419 | .with_test_defaults()
|
410 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
420 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
421 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
422 + | .allow_no_auth()
|
411 423 | .endpoint_url("https://example.com");
|
412 424 |
|
413 425 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
414 426 | let result = client
|
415 427 | .json_unions()
|
416 428 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::EnumValue(
|
417 429 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
418 430 | )))
|
419 431 | .send()
|
420 432 | .await;
|
421 433 | let _ = dbg!(result);
|
422 434 | let http_request = request_receiver.expect_request();
|
423 435 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
424 436 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
425 437 | let body = http_request.body().bytes().expect("body should be strict");
|
426 438 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
427 439 | body,
|
428 440 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
429 441 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
430 442 | ));
|
431 443 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
432 444 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
433 445 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
434 446 | }
|
435 447 |
|
436 448 | /// Serializes an intEnum union value
|
437 449 | /// Test ID: AwsJson10SerializeIntEnumUnionValue
|
438 450 | #[::tokio::test]
|
439 451 | #[::tracing_test::traced_test]
|
440 452 | async fn aws_json10_serialize_int_enum_union_value_request() {
|
441 453 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
442 454 | let config_builder = crate::config::Config::builder()
|
443 455 | .with_test_defaults()
|
444 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
456 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
457 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
458 + | .allow_no_auth()
|
445 459 | .endpoint_url("https://example.com");
|
446 460 |
|
447 461 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
448 462 | let result = client
|
449 463 | .json_unions()
|
450 464 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::IntEnumValue(1)))
|
451 465 | .send()
|
452 466 | .await;
|
453 467 | let _ = dbg!(result);
|
454 468 | let http_request = request_receiver.expect_request();
|
455 469 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
456 470 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
457 471 | let body = http_request.body().bytes().expect("body should be strict");
|
458 472 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
459 473 | body,
|
460 474 | "{\n \"contents\": {\n \"intEnumValue\": 1\n }\n}",
|
461 475 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
462 476 | ));
|
463 477 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
464 478 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
465 479 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
466 480 | }
|
467 481 |
|
468 482 | /// Serializes a list union value
|
469 483 | /// Test ID: AwsJson10SerializeListUnionValue
|
470 484 | #[::tokio::test]
|
471 485 | #[::tracing_test::traced_test]
|
472 486 | async fn aws_json10_serialize_list_union_value_request() {
|
473 487 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
474 488 | let config_builder = crate::config::Config::builder()
|
475 489 | .with_test_defaults()
|
476 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
490 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
491 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
492 + | .allow_no_auth()
|
477 493 | .endpoint_url("https://example.com");
|
478 494 |
|
479 495 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
480 496 | let result = client
|
481 497 | .json_unions()
|
482 498 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::ListValue(vec![
|
483 499 | "foo".to_owned(),
|
484 500 | "bar".to_owned(),
|
485 501 | ])))
|
486 502 | .send()
|
487 503 | .await;
|
488 504 | let _ = dbg!(result);
|
489 505 | let http_request = request_receiver.expect_request();
|
490 506 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
491 507 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
492 508 | let body = http_request.body().bytes().expect("body should be strict");
|
493 509 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
494 510 | body,
|
495 511 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
496 512 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
497 513 | ));
|
498 514 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
499 515 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
500 516 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
501 517 | }
|
502 518 |
|
503 519 | /// Serializes a map union value
|
504 520 | /// Test ID: AwsJson10SerializeMapUnionValue
|
505 521 | #[::tokio::test]
|
506 522 | #[::tracing_test::traced_test]
|
507 523 | async fn aws_json10_serialize_map_union_value_request() {
|
508 524 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
509 525 | let config_builder = crate::config::Config::builder()
|
510 526 | .with_test_defaults()
|
511 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
527 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
528 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
529 + | .allow_no_auth()
|
512 530 | .endpoint_url("https://example.com");
|
513 531 |
|
514 532 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
515 533 | let result = client
|
516 534 | .json_unions()
|
517 535 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::MapValue({
|
518 536 | let mut ret = ::std::collections::HashMap::new();
|
519 537 | ret.insert("foo".to_owned(), "bar".to_owned());
|
520 538 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
521 539 | ret
|
522 540 | })))
|
523 541 | .send()
|
524 542 | .await;
|
525 543 | let _ = dbg!(result);
|
526 544 | let http_request = request_receiver.expect_request();
|
527 545 | let expected_headers = [("Content-Type", "application/x-amz-json-1.0"), ("X-Amz-Target", "JsonRpc10.JsonUnions")];
|
528 546 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
529 547 | let body = http_request.body().bytes().expect("body should be strict");
|
530 548 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
531 549 | body,
|
532 550 | "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}",
|
533 551 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
534 552 | ));
|
535 553 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
536 554 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
537 555 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
538 556 | }
|
539 557 |
|
540 558 | /// Serializes a structure union value
|
541 559 | /// Test ID: AwsJson10SerializeStructureUnionValue
|
542 560 | #[::tokio::test]
|
543 561 | #[::tracing_test::traced_test]
|
544 562 | async fn aws_json10_serialize_structure_union_value_request() {
|
545 563 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
546 564 | let config_builder = crate::config::Config::builder()
|
547 565 | .with_test_defaults()
|
548 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
566 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
567 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
568 + | .allow_no_auth()
|
549 569 | .endpoint_url("https://example.com");
|
550 570 |
|
551 571 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
552 572 | let result = client
|
553 573 | .json_unions()
|
554 574 | .set_contents(::std::option::Option::Some(crate::types::MyUnion::StructureValue(
|
555 575 | crate::types::GreetingStruct::builder()
|
556 576 | .set_hi(::std::option::Option::Some("hello".to_owned()))
|
557 577 | .build(),
|
558 578 | )))
|