284 284 | #[allow(unreachable_code, unused_variables)]
|
285 285 | #[cfg(test)]
|
286 286 | mod upload_archive_test {
|
287 287 |
|
288 288 | /// Glacier requires that a version header be set on all requests.
|
289 289 | /// Test ID: GlacierVersionHeader
|
290 290 | #[::tokio::test]
|
291 291 | #[::tracing_test::traced_test]
|
292 292 | async fn glacier_version_header_request() {
|
293 293 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
294 - | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
294 + | let config_builder = crate::config::Config::builder()
|
295 + | .with_test_defaults()
|
296 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
297 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
298 + | .allow_no_auth()
|
299 + | .endpoint_url("https://example.com");
|
295 300 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
296 301 | let mut config_builder = config_builder;
|
297 302 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
298 303 |
|
299 304 | let config = config_builder.http_client(http_client).build();
|
300 305 | let client = crate::Client::from_conf(config);
|
301 306 | let result = client
|
302 307 | .upload_archive()
|
303 308 | .set_account_id(::std::option::Option::Some("foo".to_owned()))
|
304 309 | .set_vault_name(::std::option::Option::Some("bar".to_owned()))
|
305 310 | .send()
|
306 311 | .await;
|
307 312 | let _ = dbg!(result);
|
308 313 | let http_request = request_receiver.expect_request();
|
309 314 | let expected_headers = [("X-Amz-Glacier-Version", "2012-06-01")];
|
310 315 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
311 316 | let body = http_request.body().bytes().expect("body should be strict");
|
312 317 | // No body.
|
313 318 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
314 319 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
315 320 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
316 321 | ::pretty_assertions::assert_eq!(uri.path(), "/foo/vaults/bar/archives", "path was incorrect");
|
317 322 | }
|
318 323 |
|
319 324 | /// Glacier requires checksum headers that are cumbersome to provide.
|
320 325 | /// Test ID: GlacierChecksums
|
321 326 | #[::tokio::test]
|
322 327 | #[::tracing_test::traced_test]
|
323 328 | async fn glacier_checksums_request() {
|
324 329 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
325 - | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
330 + | let config_builder = crate::config::Config::builder()
|
331 + | .with_test_defaults()
|
332 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
333 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
334 + | .allow_no_auth()
|
335 + | .endpoint_url("https://example.com");
|
326 336 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
327 337 | let mut config_builder = config_builder;
|
328 338 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
329 339 |
|
330 340 | let config = config_builder.http_client(http_client).build();
|
331 341 | let client = crate::Client::from_conf(config);
|
332 342 | let result = client
|
333 343 | .upload_archive()
|
334 344 | .set_account_id(::std::option::Option::Some("foo".to_owned()))
|
335 345 | .set_vault_name(::std::option::Option::Some("bar".to_owned()))
|
336 346 | .set_body(::std::option::Option::Some(::aws_smithy_types::byte_stream::ByteStream::from_static(
|
337 347 | b"hello world",
|
338 348 | )))
|
339 349 | .send()
|
340 350 | .await;
|
341 351 | let _ = dbg!(result);
|
342 352 | let http_request = request_receiver.expect_request();
|
343 353 | let expected_headers = [
|
344 354 | ("X-Amz-Content-Sha256", "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9"),
|
345 355 | ("X-Amz-Glacier-Version", "2012-06-01"),
|
346 356 | (
|
347 357 | "X-Amz-Sha256-Tree-Hash",
|
348 358 | "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9",
|
349 359 | ),
|
350 360 | ];
|
351 361 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
352 362 | let body = http_request.body().bytes().expect("body should be strict");
|
353 363 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
354 364 | body,
|
355 365 | "hello world",
|
356 366 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
357 367 | ));
|
358 368 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
359 369 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
360 370 | ::pretty_assertions::assert_eq!(uri.path(), "/foo/vaults/bar/archives", "path was incorrect");
|
361 371 | }
|
362 372 |
|
363 373 | /// Glacier requires that the account id be set, but you can just use a
|
364 374 | /// hyphen (-) to indicate the current account. This should be default
|
365 375 | /// behavior if the customer provides a null or empty string.
|
366 376 | /// Test ID: GlacierAccountIdEmpty
|
367 377 | #[::tokio::test]
|
368 378 | #[::tracing_test::traced_test]
|
369 379 | async fn glacier_account_id_empty_request() {
|
370 380 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
371 - | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
381 + | let config_builder = crate::config::Config::builder()
|
382 + | .with_test_defaults()
|
383 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
384 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
385 + | .allow_no_auth()
|
386 + | .endpoint_url("https://example.com");
|
372 387 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
373 388 | let mut config_builder = config_builder;
|
374 389 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
375 390 |
|
376 391 | let config = config_builder.http_client(http_client).build();
|
377 392 | let client = crate::Client::from_conf(config);
|
378 393 | let result = client
|
379 394 | .upload_archive()
|
380 395 | .set_account_id(::std::option::Option::Some("".to_owned()))
|
381 396 | .set_vault_name(::std::option::Option::Some("bar".to_owned()))
|
382 397 | .send()
|
383 398 | .await;
|
384 399 | let _ = dbg!(result);
|
385 400 | let http_request = request_receiver.expect_request();
|
386 401 | let expected_headers = [("X-Amz-Glacier-Version", "2012-06-01")];
|
387 402 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
388 403 | let body = http_request.body().bytes().expect("body should be strict");
|
389 404 | // No body.
|
390 405 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
391 406 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
392 407 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
393 408 | ::pretty_assertions::assert_eq!(uri.path(), "/-/vaults/bar/archives", "path was incorrect");
|
394 409 | }
|
395 410 |
|
396 411 | /// Glacier requires that the account id be set, but you can just use a
|
397 412 | /// hyphen (-) to indicate the current account. This should be default
|
398 413 | /// behavior if the customer provides a null or empty string.
|
399 414 | /// Test ID: GlacierAccountIdUnset
|
400 415 | #[::tokio::test]
|
401 416 | #[::tracing_test::traced_test]
|
402 417 | async fn glacier_account_id_unset_request() {
|
403 418 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
404 - | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
419 + | let config_builder = crate::config::Config::builder()
|
420 + | .with_test_defaults()
|
421 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
422 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
423 + | .allow_no_auth()
|
424 + | .endpoint_url("https://example.com");
|
405 425 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
406 426 | let mut config_builder = config_builder;
|
407 427 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
408 428 |
|
409 429 | let config = config_builder.http_client(http_client).build();
|
410 430 | let client = crate::Client::from_conf(config);
|
411 431 | let result = client
|
412 432 | .upload_archive()
|
413 433 | .set_vault_name(::std::option::Option::Some("bar".to_owned()))
|
414 434 | .set_account_id(::std::option::Option::None)
|