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