249 249 | use ::aws_smithy_protocol_test::FloatEquals;
|
250 250 |
|
251 251 | /// Serializes simple scalar properties
|
252 252 | /// Test ID: RpcV2CborSimpleScalarProperties
|
253 253 | #[::tokio::test]
|
254 254 | #[::tracing_test::traced_test]
|
255 255 | async fn rpc_v2_cbor_simple_scalar_properties_request() {
|
256 256 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
257 257 | let config_builder = crate::config::Config::builder()
|
258 258 | .with_test_defaults()
|
259 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
259 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
260 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
261 + | .allow_no_auth()
|
260 262 | .endpoint_url("https://example.com");
|
261 263 |
|
262 264 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
263 265 | let result = client
|
264 266 | .simple_scalar_properties()
|
265 267 | .set_byte_value(::std::option::Option::Some(5))
|
266 268 | .set_double_value(::std::option::Option::Some(1.889_f64))
|
267 269 | .set_false_boolean_value(::std::option::Option::Some(false))
|
268 270 | .set_float_value(::std::option::Option::Some(7.625_f32))
|
269 271 | .set_integer_value(::std::option::Option::Some(256))
|
270 272 | .set_long_value(::std::option::Option::Some(9873))
|
271 273 | .set_short_value(::std::option::Option::Some(9898))
|
272 274 | .set_string_value(::std::option::Option::Some("simple".to_owned()))
|
273 275 | .set_true_boolean_value(::std::option::Option::Some(true))
|
274 276 | .set_blob_value(::std::option::Option::Some(::aws_smithy_types::Blob::new("foo")))
|
275 277 | .send()
|
276 278 | .await;
|
277 279 | let _ = dbg!(result);
|
278 280 | let http_request = request_receiver.expect_request();
|
279 281 | let expected_headers = [
|
280 282 | ("Accept", "application/cbor"),
|
281 283 | ("Content-Type", "application/cbor"),
|
282 284 | ("smithy-protocol", "rpc-v2-cbor"),
|
283 285 | ];
|
284 286 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
285 287 | let required_headers = &["Content-Length"];
|
286 288 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
287 289 | let body = http_request.body().bytes().expect("body should be strict");
|
288 290 | ::aws_smithy_protocol_test::assert_ok(
|
289 291 | ::aws_smithy_protocol_test::validate_body(body, "v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
290 292 | );
|
291 293 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
292 294 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
293 295 | ::pretty_assertions::assert_eq!(
|
294 296 | uri.path(),
|
295 297 | "/service/RpcV2Protocol/operation/SimpleScalarProperties",
|
296 298 | "path was incorrect"
|
297 299 | );
|
298 300 | }
|
299 301 |
|
300 302 | /// RpcV2 Cbor should not serialize null structure values
|
301 303 | /// Test ID: RpcV2CborClientDoesntSerializeNullStructureValues
|
302 304 | #[::tokio::test]
|
303 305 | #[::tracing_test::traced_test]
|
304 306 | async fn rpc_v2_cbor_client_doesnt_serialize_null_structure_values_request() {
|
305 307 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
306 308 | let config_builder = crate::config::Config::builder()
|
307 309 | .with_test_defaults()
|
308 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
310 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
311 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
312 + | .allow_no_auth()
|
309 313 | .endpoint_url("https://example.com");
|
310 314 |
|
311 315 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
312 316 | let result = client
|
313 317 | .simple_scalar_properties()
|
314 318 | .set_string_value(::std::option::Option::None)
|
315 319 | .send()
|
316 320 | .await;
|
317 321 | let _ = dbg!(result);
|
318 322 | let http_request = request_receiver.expect_request();
|
319 323 | let expected_headers = [
|
320 324 | ("Accept", "application/cbor"),
|
321 325 | ("Content-Type", "application/cbor"),
|
322 326 | ("smithy-protocol", "rpc-v2-cbor"),
|
323 327 | ];
|
324 328 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
325 329 | let required_headers = &["Content-Length"];
|
326 330 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
327 331 | let body = http_request.body().bytes().expect("body should be strict");
|
328 332 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
329 333 | body,
|
330 334 | "v/8=",
|
331 335 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
332 336 | ));
|
333 337 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
334 338 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
335 339 | ::pretty_assertions::assert_eq!(
|
336 340 | uri.path(),
|
337 341 | "/service/RpcV2Protocol/operation/SimpleScalarProperties",
|
338 342 | "path was incorrect"
|
339 343 | );
|
340 344 | }
|
341 345 |
|
342 346 | /// Supports handling NaN float values.
|
343 347 | /// Test ID: RpcV2CborSupportsNaNFloatInputs
|
344 348 | #[::tokio::test]
|
345 349 | #[::tracing_test::traced_test]
|
346 350 | async fn rpc_v2_cbor_supports_na_n_float_inputs_request() {
|
347 351 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
348 352 | let config_builder = crate::config::Config::builder()
|
349 353 | .with_test_defaults()
|
350 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
354 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
355 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
356 + | .allow_no_auth()
|
351 357 | .endpoint_url("https://example.com");
|
352 358 |
|
353 359 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
354 360 | let result = client
|
355 361 | .simple_scalar_properties()
|
356 362 | .set_double_value(::std::option::Option::Some(
|
357 363 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
358 364 | ))
|
359 365 | .set_float_value(::std::option::Option::Some(
|
360 366 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
361 367 | ))
|
362 368 | .send()
|
363 369 | .await;
|
364 370 | let _ = dbg!(result);
|
365 371 | let http_request = request_receiver.expect_request();
|
366 372 | let expected_headers = [
|
367 373 | ("Accept", "application/cbor"),
|
368 374 | ("Content-Type", "application/cbor"),
|
369 375 | ("smithy-protocol", "rpc-v2-cbor"),
|
370 376 | ];
|
371 377 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
372 378 | let required_headers = &["Content-Length"];
|
373 379 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
374 380 | let body = http_request.body().bytes().expect("body should be strict");
|
375 381 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
376 382 | body,
|
377 383 | "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/",
|
378 384 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
379 385 | ));
|
380 386 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
381 387 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
382 388 | ::pretty_assertions::assert_eq!(
|
383 389 | uri.path(),
|
384 390 | "/service/RpcV2Protocol/operation/SimpleScalarProperties",
|
385 391 | "path was incorrect"
|
386 392 | );
|
387 393 | }
|
388 394 |
|
389 395 | /// Supports handling Infinity float values.
|
390 396 | /// Test ID: RpcV2CborSupportsInfinityFloatInputs
|
391 397 | #[::tokio::test]
|
392 398 | #[::tracing_test::traced_test]
|
393 399 | async fn rpc_v2_cbor_supports_infinity_float_inputs_request() {
|
394 400 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
395 401 | let config_builder = crate::config::Config::builder()
|
396 402 | .with_test_defaults()
|
397 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
403 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
404 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
405 + | .allow_no_auth()
|
398 406 | .endpoint_url("https://example.com");
|
399 407 |
|
400 408 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
401 409 | let result = client
|
402 410 | .simple_scalar_properties()
|
403 411 | .set_double_value(::std::option::Option::Some(
|
404 412 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
405 413 | ))
|
406 414 | .set_float_value(::std::option::Option::Some(
|
407 415 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
408 416 | ))
|
409 417 | .send()
|
410 418 | .await;
|
411 419 | let _ = dbg!(result);
|
412 420 | let http_request = request_receiver.expect_request();
|
413 421 | let expected_headers = [
|
414 422 | ("Accept", "application/cbor"),
|
415 423 | ("Content-Type", "application/cbor"),
|
416 424 | ("smithy-protocol", "rpc-v2-cbor"),
|
417 425 | ];
|
418 426 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
419 427 | let required_headers = &["Content-Length"];
|
420 428 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
|
421 429 | let body = http_request.body().bytes().expect("body should be strict");
|
422 430 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
423 431 | body,
|
424 432 | "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/",
|
425 433 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
426 434 | ));
|
427 435 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
428 436 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
429 437 | ::pretty_assertions::assert_eq!(
|
430 438 | uri.path(),
|
431 439 | "/service/RpcV2Protocol/operation/SimpleScalarProperties",
|
432 440 | "path was incorrect"
|
433 441 | );
|
434 442 | }
|
435 443 |
|
436 444 | /// Supports handling Infinity float values.
|
437 445 | /// Test ID: RpcV2CborSupportsNegativeInfinityFloatInputs
|
438 446 | #[::tokio::test]
|
439 447 | #[::tracing_test::traced_test]
|
440 448 | async fn rpc_v2_cbor_supports_negative_infinity_float_inputs_request() {
|
441 449 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
442 450 | let config_builder = crate::config::Config::builder()
|
443 451 | .with_test_defaults()
|
444 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
452 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
453 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
454 + | .allow_no_auth()
|
445 455 | .endpoint_url("https://example.com");
|
446 456 |
|
447 457 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
448 458 | let result = client
|
449 459 | .simple_scalar_properties()
|
450 460 | .set_double_value(::std::option::Option::Some(
|
451 461 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|
452 462 | ))
|
453 463 | .set_float_value(::std::option::Option::Some(
|
454 464 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|