236 236 | mod xml_timestamps_test {
|
237 237 |
|
238 238 | /// Tests how normal timestamps are serialized
|
239 239 | /// Test ID: XmlTimestamps
|
240 240 | #[::tokio::test]
|
241 241 | #[::tracing_test::traced_test]
|
242 242 | async fn xml_timestamps_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 | .xml_timestamps()
|
252 254 | .set_normal(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
253 255 | 1398796238, 0_f64,
|
254 256 | )))
|
255 257 | .send()
|
256 258 | .await;
|
257 259 | let _ = dbg!(result);
|
258 260 | let http_request = request_receiver.expect_request();
|
259 261 | let expected_headers = [("Content-Type", "application/xml")];
|
260 262 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
261 263 | let body = http_request.body().bytes().expect("body should be strict");
|
262 264 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
263 265 | body,
|
264 266 | "<XmlTimestampsRequest>\n <normal>2014-04-29T18:30:38Z</normal>\n</XmlTimestampsRequest>\n",
|
265 267 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
266 268 | ));
|
267 269 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
268 270 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
269 271 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
270 272 | }
|
271 273 |
|
272 274 | /// Ensures that the timestampFormat of date-time works like normal timestamps
|
273 275 | /// Test ID: XmlTimestampsWithDateTimeFormat
|
274 276 | #[::tokio::test]
|
275 277 | #[::tracing_test::traced_test]
|
276 278 | async fn xml_timestamps_with_date_time_format_request() {
|
277 279 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
278 280 | let config_builder = crate::config::Config::builder()
|
279 281 | .with_test_defaults()
|
280 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
282 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
283 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
284 + | .allow_no_auth()
|
281 285 | .endpoint_url("https://example.com");
|
282 286 |
|
283 287 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
284 288 | let result = client
|
285 289 | .xml_timestamps()
|
286 290 | .set_date_time(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
287 291 | 1398796238, 0_f64,
|
288 292 | )))
|
289 293 | .send()
|
290 294 | .await;
|
291 295 | let _ = dbg!(result);
|
292 296 | let http_request = request_receiver.expect_request();
|
293 297 | let expected_headers = [("Content-Type", "application/xml")];
|
294 298 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
295 299 | let body = http_request.body().bytes().expect("body should be strict");
|
296 300 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
297 301 | body,
|
298 302 | "<XmlTimestampsRequest>\n <dateTime>2014-04-29T18:30:38Z</dateTime>\n</XmlTimestampsRequest>\n",
|
299 303 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
300 304 | ));
|
301 305 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
302 306 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
303 307 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
304 308 | }
|
305 309 |
|
306 310 | /// Ensures that the timestampFormat of date-time on the target shape works like normal timestamps
|
307 311 | /// Test ID: XmlTimestampsWithDateTimeOnTargetFormat
|
308 312 | #[::tokio::test]
|
309 313 | #[::tracing_test::traced_test]
|
310 314 | async fn xml_timestamps_with_date_time_on_target_format_request() {
|
311 315 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
312 316 | let config_builder = crate::config::Config::builder()
|
313 317 | .with_test_defaults()
|
314 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
318 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
319 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
320 + | .allow_no_auth()
|
315 321 | .endpoint_url("https://example.com");
|
316 322 |
|
317 323 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
318 324 | let result = client
|
319 325 | .xml_timestamps()
|
320 326 | .set_date_time_on_target(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
321 327 | 1398796238, 0_f64,
|
322 328 | )))
|
323 329 | .send()
|
324 330 | .await;
|
325 331 | let _ = dbg!(result);
|
326 332 | let http_request = request_receiver.expect_request();
|
327 333 | let expected_headers = [("Content-Type", "application/xml")];
|
328 334 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
329 335 | let body = http_request.body().bytes().expect("body should be strict");
|
330 336 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
331 337 | body,
|
332 338 | "<XmlTimestampsRequest>\n <dateTimeOnTarget>2014-04-29T18:30:38Z</dateTimeOnTarget>\n</XmlTimestampsRequest>\n",
|
333 339 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
334 340 | ));
|
335 341 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
336 342 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
337 343 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
338 344 | }
|
339 345 |
|
340 346 | /// Ensures that the timestampFormat of epoch-seconds works
|
341 347 | /// Test ID: XmlTimestampsWithEpochSecondsFormat
|
342 348 | #[::tokio::test]
|
343 349 | #[::tracing_test::traced_test]
|
344 350 | async fn xml_timestamps_with_epoch_seconds_format_request() {
|
345 351 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
346 352 | let config_builder = crate::config::Config::builder()
|
347 353 | .with_test_defaults()
|
348 - | .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()
|
349 357 | .endpoint_url("https://example.com");
|
350 358 |
|
351 359 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
352 360 | let result = client
|
353 361 | .xml_timestamps()
|
354 362 | .set_epoch_seconds(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
355 363 | 1398796238, 0_f64,
|
356 364 | )))
|
357 365 | .send()
|
358 366 | .await;
|
359 367 | let _ = dbg!(result);
|
360 368 | let http_request = request_receiver.expect_request();
|
361 369 | let expected_headers = [("Content-Type", "application/xml")];
|
362 370 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
363 371 | let body = http_request.body().bytes().expect("body should be strict");
|
364 372 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
365 373 | body,
|
366 374 | "<XmlTimestampsRequest>\n <epochSeconds>1398796238</epochSeconds>\n</XmlTimestampsRequest>\n",
|
367 375 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
368 376 | ));
|
369 377 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
370 378 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
371 379 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
372 380 | }
|
373 381 |
|
374 382 | /// Ensures that the timestampFormat of epoch-seconds on the target shape works
|
375 383 | /// Test ID: XmlTimestampsWithEpochSecondsOnTargetFormat
|
376 384 | #[::tokio::test]
|
377 385 | #[::tracing_test::traced_test]
|
378 386 | async fn xml_timestamps_with_epoch_seconds_on_target_format_request() {
|
379 387 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
380 388 | let config_builder = crate::config::Config::builder()
|
381 389 | .with_test_defaults()
|
382 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
390 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
391 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
392 + | .allow_no_auth()
|
383 393 | .endpoint_url("https://example.com");
|
384 394 |
|
385 395 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
386 396 | let result = client
|
387 397 | .xml_timestamps()
|
388 398 | .set_epoch_seconds_on_target(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
389 399 | 1398796238, 0_f64,
|
390 400 | )))
|
391 401 | .send()
|
392 402 | .await;
|
393 403 | let _ = dbg!(result);
|
394 404 | let http_request = request_receiver.expect_request();
|
395 405 | let expected_headers = [("Content-Type", "application/xml")];
|
396 406 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
397 407 | let body = http_request.body().bytes().expect("body should be strict");
|
398 408 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
399 409 | body,
|
400 410 | "<XmlTimestampsRequest>\n <epochSecondsOnTarget>1398796238</epochSecondsOnTarget>\n</XmlTimestampsRequest>\n",
|
401 411 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
402 412 | ));
|
403 413 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
404 414 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
405 415 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
406 416 | }
|
407 417 |
|
408 418 | /// Ensures that the timestampFormat of http-date works
|
409 419 | /// Test ID: XmlTimestampsWithHttpDateFormat
|
410 420 | #[::tokio::test]
|
411 421 | #[::tracing_test::traced_test]
|
412 422 | async fn xml_timestamps_with_http_date_format_request() {
|
413 423 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
414 424 | let config_builder = crate::config::Config::builder()
|
415 425 | .with_test_defaults()
|
416 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
426 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
427 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
428 + | .allow_no_auth()
|
417 429 | .endpoint_url("https://example.com");
|
418 430 |
|
419 431 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
420 432 | let result = client
|
421 433 | .xml_timestamps()
|
422 434 | .set_http_date(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
423 435 | 1398796238, 0_f64,
|
424 436 | )))
|
425 437 | .send()
|
426 438 | .await;
|
427 439 | let _ = dbg!(result);
|
428 440 | let http_request = request_receiver.expect_request();
|
429 441 | let expected_headers = [("Content-Type", "application/xml")];
|
430 442 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
431 443 | let body = http_request.body().bytes().expect("body should be strict");
|
432 444 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
433 445 | body,
|
434 446 | "<XmlTimestampsRequest>\n <httpDate>Tue, 29 Apr 2014 18:30:38 GMT</httpDate>\n</XmlTimestampsRequest>\n",
|
435 447 | ::aws_smithy_protocol_test::MediaType::from("application/xml"),
|
436 448 | ));
|
437 449 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
438 450 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
439 451 | ::pretty_assertions::assert_eq!(uri.path(), "/XmlTimestamps", "path was incorrect");
|
440 452 | }
|
441 453 |
|
442 454 | /// Ensures that the timestampFormat of http-date on the target shape works
|
443 455 | /// Test ID: XmlTimestampsWithHttpDateOnTargetFormat
|
444 456 | #[::tokio::test]
|
445 457 | #[::tracing_test::traced_test]
|
446 458 | async fn xml_timestamps_with_http_date_on_target_format_request() {
|
447 459 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
448 460 | let config_builder = crate::config::Config::builder()
|
449 461 | .with_test_defaults()
|
450 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
462 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
463 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
464 + | .allow_no_auth()
|
451 465 | .endpoint_url("https://example.com");
|
452 466 |
|
453 467 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
454 468 | let result = client
|
455 469 | .xml_timestamps()
|
456 470 | .set_http_date_on_target(::std::option::Option::Some(::aws_smithy_types::DateTime::from_fractional_secs(
|
457 471 | 1398796238, 0_f64,
|
458 472 | )))
|
459 473 | .send()
|
460 474 | .await;
|