Add a test helper for creating a dummy Credentials (#2145)
* Add convenience method `Credentials::for_tests` This commit addresses https://github.com/awslabs/smithy-rs/pull/2122#discussion_r1056499862. We considered using `#[cfg(test)]` for it but the attribute only works within the defining crate. To work around it, we have added `#[doc(hidden)]` to it to prevent the method from appearing in the public doc, though still accessible in the source code. * Make AWS runtime crates use test credentials helper This commit updates the test code in the AWS runtime crates to use `Credentials::for_tests` wherever applicable. We intentionally did not replace the following `Credentials::new` occurrences: * those in public rustdoc * those that need to configure expiration time * Make EndpointsCredentialsTest use test credentials helper This commit replaces `Credentials::new` with `Credentials::for_tests` in the unit test for EndpointsCredentialsTest. * Make SDK integration tests use test credentials helper This commit replaces `Credentials::new` with `Credentials::for_tests` in the test code in the SDK integration tests wherever applicable. * Call `Credentials::for_tests` directly in calling `credentials_provider` * Feature gate `Credentials::for_tests` behind "test-util" This commit addresses https://github.com/awslabs/smithy-rs/pull/2145#discussion_r1059437196 * Use `Credentials::for_tests` rather than `new` This commit addresses https://github.com/awslabs/smithy-rs/pull/2145#discussion_r1059437435 Co-authored-by:Yuki Saito <awsaito@amazon.com>
Loading
Please register or sign in to comment