summaryrefslogtreecommitdiffstats
path: root/tests/testsuite
diff options
context:
space:
mode:
authorThomas O'Donnell <andytom@users.noreply.github.com>2019-09-26 04:55:47 +0200
committerKevin Song <chipbuster@users.noreply.github.com>2019-09-25 21:55:47 -0500
commitb050c597081967cbe7135d294f0cf43c2ec7608d (patch)
treef352a022b49ad9fb1b5d5fed1effe549b3e08e2f /tests/testsuite
parent80a9e7b9a638e4e695be8280a9baff3550037111 (diff)
feat: Add AWS module (#419)
Adds a module for displaying the current AWS profile based on the AWS_PROFILE envar.
Diffstat (limited to 'tests/testsuite')
-rw-r--r--tests/testsuite/aws.rs25
-rw-r--r--tests/testsuite/main.rs1
2 files changed, 26 insertions, 0 deletions
diff --git a/tests/testsuite/aws.rs b/tests/testsuite/aws.rs
new file mode 100644
index 000000000..d02bccca2
--- /dev/null
+++ b/tests/testsuite/aws.rs
@@ -0,0 +1,25 @@
+use ansi_term::Color;
+use std::io;
+
+use crate::common;
+
+#[test]
+fn no_profile_set() -> io::Result<()> {
+ let output = common::render_module("aws").env_clear().output()?;
+ let expected = "";
+ let actual = String::from_utf8(output.stdout).unwrap();
+ assert_eq!(expected, actual);
+ Ok(())
+}
+
+#[test]
+fn profile_set() -> io::Result<()> {
+ let output = common::render_module("aws")
+ .env_clear()
+ .env("AWS_PROFILE", "astronauts")
+ .output()?;
+ let expected = format!("on {} ", Color::Yellow.bold().paint("☁️ astronauts"));
+ let actual = String::from_utf8(output.stdout).unwrap();
+ assert_eq!(expected, actual);
+ Ok(())
+}
diff --git a/tests/testsuite/main.rs b/tests/testsuite/main.rs
index d299ca610..89f573f9c 100644
--- a/tests/testsuite/main.rs
+++ b/tests/testsuite/main.rs
@@ -1,3 +1,4 @@
+mod aws;
mod character;
mod cmd_duration;
mod common;