242 242 | mod rpc_v2_cbor_sparse_maps_test {
|
243 243 |
|
244 244 | /// Serializes sparse maps
|
245 245 | /// Test ID: RpcV2CborSparseMaps
|
246 246 | #[::tokio::test]
|
247 247 | #[::tracing_test::traced_test]
|
248 248 | async fn rpc_v2_cbor_sparse_maps_request() {
|
249 249 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
250 250 | let config_builder = crate::config::Config::builder()
|
251 251 | .with_test_defaults()
|
252 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
252 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
253 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
254 + | .allow_no_auth()
|
253 255 | .endpoint_url("https://example.com");
|
254 256 |
|
255 257 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
256 258 | let result = client
|
257 259 | .rpc_v2_cbor_sparse_maps()
|
258 260 | .set_sparse_struct_map(::std::option::Option::Some({
|
259 261 | let mut ret = ::std::collections::HashMap::new();
|
260 262 | ret.insert(
|
261 263 | "foo".to_owned(),
|
262 264 | ::std::option::Option::Some(
|
263 265 | crate::types::GreetingStruct::builder()
|
264 266 | .set_hi(::std::option::Option::Some("there".to_owned()))
|
265 267 | .build(),
|
266 268 | ),
|
267 269 | );
|
268 270 | ret.insert(
|
269 271 | "baz".to_owned(),
|
270 272 | ::std::option::Option::Some(
|
271 273 | crate::types::GreetingStruct::builder()
|
272 274 | .set_hi(::std::option::Option::Some("bye".to_owned()))
|
273 275 | .build(),
|
274 276 | ),
|
275 277 | );
|
276 278 | ret
|
277 279 | }))
|
278 280 | .send()
|
279 281 | .await;
|
280 282 | let _ = dbg!(result);
|
281 283 | let http_request = request_receiver.expect_request();
|
282 284 | let expected_headers = [
|
283 285 | ("Accept", "application/cbor"),
|
284 286 | ("Content-Type", "application/cbor"),
|
285 287 | ("smithy-protocol", "rpc-v2-cbor"),
|
286 288 | ];
|
287 289 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
288 290 | let required_headers = &["Content-Length"];
|
289 291 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
290 292 | let body = http_request.body().bytes().expect("body should be strict");
|
291 293 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
292 294 | body,
|
293 295 | "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////",
|
294 296 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
295 297 | ));
|
296 298 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
297 299 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
298 300 | ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
|
299 301 | }
|
300 302 |
|
301 303 | /// Serializes null map values in sparse maps
|
302 304 | /// Test ID: RpcV2CborSerializesNullMapValues
|
303 305 | #[::tokio::test]
|
304 306 | #[::tracing_test::traced_test]
|
305 307 | async fn rpc_v2_cbor_serializes_null_map_values_request() {
|
306 308 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
307 309 | let config_builder = crate::config::Config::builder()
|
308 310 | .with_test_defaults()
|
309 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
311 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
312 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
313 + | .allow_no_auth()
|
310 314 | .endpoint_url("https://example.com");
|
311 315 |
|
312 316 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
313 317 | let result = client
|
314 318 | .rpc_v2_cbor_sparse_maps()
|
315 319 | .set_sparse_boolean_map(::std::option::Option::Some({
|
316 320 | let mut ret = ::std::collections::HashMap::new();
|
317 321 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
318 322 | ret
|
319 323 | }))
|
320 324 | .set_sparse_number_map(::std::option::Option::Some({
|
321 325 | let mut ret = ::std::collections::HashMap::new();
|
322 326 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
323 327 | ret
|
324 328 | }))
|
325 329 | .set_sparse_string_map(::std::option::Option::Some({
|
326 330 | let mut ret = ::std::collections::HashMap::new();
|
327 331 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
328 332 | ret
|
329 333 | }))
|
330 334 | .set_sparse_struct_map(::std::option::Option::Some({
|
331 335 | let mut ret = ::std::collections::HashMap::new();
|
332 336 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
333 337 | ret
|
334 338 | }))
|
335 339 | .send()
|
336 340 | .await;
|
337 341 | let _ = dbg!(result);
|
338 342 | let http_request = request_receiver.expect_request();
|
339 343 | let expected_headers = [
|
340 344 | ("Accept", "application/cbor"),
|
341 345 | ("Content-Type", "application/cbor"),
|
342 346 | ("smithy-protocol", "rpc-v2-cbor"),
|
343 347 | ];
|
344 348 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
345 349 | let required_headers = &["Content-Length"];
|
346 350 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
347 351 | let body = http_request.body().bytes().expect("body should be strict");
|
348 352 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
349 353 | body,
|
350 354 | "v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//",
|
351 355 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
352 356 | ));
|
353 357 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
354 358 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
355 359 | ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
|
356 360 | }
|
357 361 |
|
358 362 | /// A request that contains a sparse map of sets
|
359 363 | /// Test ID: RpcV2CborSerializesSparseSetMap
|
360 364 | #[::tokio::test]
|
361 365 | #[::tracing_test::traced_test]
|
362 366 | async fn rpc_v2_cbor_serializes_sparse_set_map_request() {
|
363 367 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
364 368 | let config_builder = crate::config::Config::builder()
|
365 369 | .with_test_defaults()
|
366 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
370 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
371 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
372 + | .allow_no_auth()
|
367 373 | .endpoint_url("https://example.com");
|
368 374 |
|
369 375 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
370 376 | let result = client
|
371 377 | .rpc_v2_cbor_sparse_maps()
|
372 378 | .set_sparse_set_map(::std::option::Option::Some({
|
373 379 | let mut ret = ::std::collections::HashMap::new();
|
374 380 | ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
|
375 381 | ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
|
376 382 | ret
|
377 383 | }))
|
378 384 | .send()
|
379 385 | .await;
|
380 386 | let _ = dbg!(result);
|
381 387 | let http_request = request_receiver.expect_request();
|
382 388 | let expected_headers = [
|
383 389 | ("Accept", "application/cbor"),
|
384 390 | ("Content-Type", "application/cbor"),
|
385 391 | ("smithy-protocol", "rpc-v2-cbor"),
|
386 392 | ];
|
387 393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
388 394 | let required_headers = &["Content-Length"];
|
389 395 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
390 396 | let body = http_request.body().bytes().expect("body should be strict");
|
391 397 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
392 398 | body,
|
393 399 | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL///8=",
|
394 400 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
395 401 | ));
|
396 402 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
397 403 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
398 404 | ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
|
399 405 | }
|
400 406 |
|
401 407 | /// A request that contains a sparse map of sets.
|
402 408 | /// Test ID: RpcV2CborSerializesSparseSetMapAndRetainsNull
|
403 409 | #[::tokio::test]
|
404 410 | #[::tracing_test::traced_test]
|
405 411 | async fn rpc_v2_cbor_serializes_sparse_set_map_and_retains_null_request() {
|
406 412 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
407 413 | let config_builder = crate::config::Config::builder()
|
408 414 | .with_test_defaults()
|
409 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
415 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
416 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
417 + | .allow_no_auth()
|
410 418 | .endpoint_url("https://example.com");
|
411 419 |
|
412 420 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
413 421 | let result = client
|
414 422 | .rpc_v2_cbor_sparse_maps()
|
415 423 | .set_sparse_set_map(::std::option::Option::Some({
|
416 424 | let mut ret = ::std::collections::HashMap::new();
|
417 425 | ret.insert("x".to_owned(), ::std::option::Option::Some(vec![]));
|
418 426 | ret.insert("y".to_owned(), ::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned()]));
|
419 427 | ret.insert("z".to_owned(), ::std::option::Option::None);
|
420 428 | ret
|
421 429 | }))
|
422 430 | .send()
|
423 431 | .await;
|
424 432 | let _ = dbg!(result);
|
425 433 | let http_request = request_receiver.expect_request();
|
426 434 | let expected_headers = [
|
427 435 | ("Accept", "application/cbor"),
|
428 436 | ("Content-Type", "application/cbor"),
|
429 437 | ("smithy-protocol", "rpc-v2-cbor"),
|
430 438 | ];
|
431 439 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
432 440 | let required_headers = &["Content-Length"];
|
433 441 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
434 442 | let body = http_request.body().bytes().expect("body should be strict");
|
435 443 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
436 444 | body,
|
437 445 | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=",
|
438 446 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
439 447 | ));
|
440 448 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
441 449 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
442 450 | ::pretty_assertions::assert_eq!(uri.path(), "/service/RpcV2Protocol/operation/RpcV2CborSparseMaps", "path was incorrect");
|
443 451 | }
|
444 452 |
|
445 453 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
446 454 | /// Test ID: RpcV2CborSerializesZeroValuesInSparseMaps
|
447 455 | #[::tokio::test]
|
448 456 | #[::tracing_test::traced_test]
|
449 457 | async fn rpc_v2_cbor_serializes_zero_values_in_sparse_maps_request() {
|
450 458 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
451 459 | let config_builder = crate::config::Config::builder()
|
452 460 | .with_test_defaults()
|
453 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
461 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
462 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
463 + | .allow_no_auth()
|
454 464 | .endpoint_url("https://example.com");
|
455 465 |
|
456 466 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
457 467 | let result = client
|
458 468 | .rpc_v2_cbor_sparse_maps()
|
459 469 | .set_sparse_number_map(::std::option::Option::Some({
|
460 470 | let mut ret = ::std::collections::HashMap::new();
|
461 471 | ret.insert("x".to_owned(), ::std::option::Option::Some(0));
|
462 472 | ret
|
463 473 | }))
|