mirror of
https://github.com/starship/starship.git
synced 2024-11-22 16:23:17 +01:00
chore(aws): fix unintended test failure of aws::missing_any_credentials
(#4805)
chore(aws): fix unintended test failure of `aws::missing_any_credentials` Because its mocking is not enough, The test may unintentionally fail if `~/.aws/credentials` exists. This commit fixes this issue by mocking `credentials` file as well.
This commit is contained in:
parent
e88484d567
commit
64e0208708
@ -802,10 +802,14 @@ aws_secret_access_key=dummy
|
||||
#[test]
|
||||
fn missing_any_credentials() -> io::Result<()> {
|
||||
let dir = tempfile::tempdir()?;
|
||||
let config_path = dir.path().join("config");
|
||||
let mut file = File::create(&config_path)?;
|
||||
|
||||
file.write_all(
|
||||
let credential_path = dir.path().join("credentials");
|
||||
File::create(&credential_path)?;
|
||||
|
||||
let config_path = dir.path().join("config");
|
||||
let mut config_file = File::create(&config_path)?;
|
||||
|
||||
config_file.write_all(
|
||||
"[default]
|
||||
region = us-east-1
|
||||
output = json
|
||||
@ -818,6 +822,10 @@ region = us-east-2
|
||||
|
||||
let actual = ModuleRenderer::new("aws")
|
||||
.env("AWS_CONFIG_FILE", config_path.to_string_lossy().as_ref())
|
||||
.env(
|
||||
"AWS_CREDENTIALS_FILE",
|
||||
credential_path.to_string_lossy().as_ref(),
|
||||
)
|
||||
.collect();
|
||||
let expected = None;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user