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