Skip to content

Commit 2b62463

Browse files
committed
test: add test for get production configuration
1 parent bb0c1c2 commit 2b62463

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

rook/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rook/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ quickcheck = "1.0.3"
4343
quickcheck_macros = "1.1.0"
4444
wiremock = "0.6.4"
4545
mockall = "0.13"
46+
shuttle-common = "0.56.0"

rook/src/configuration.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ impl TryFrom<String> for Environment {
145145
#[cfg(test)]
146146
mod tests {
147147
use super::*;
148+
use shuttle_common::secrets::Secret;
149+
use std::collections::BTreeMap;
148150

149151
#[test]
150152
fn test_environment_as_str() {
@@ -188,4 +190,22 @@ mod tests {
188190
assert_eq!(settings.application.port, 8080);
189191
Ok(())
190192
}
193+
194+
#[test]
195+
fn test_get_production_configuration() -> Result<(), config::ConfigError> {
196+
let secrets = SecretStore::new(BTreeMap::from([
197+
(
198+
"POSTMARK_SENDER_EMAIL".to_string(),
199+
Secret::new("noreply@queens.ac".to_string()),
200+
),
201+
(
202+
"POSTMARK_AUTH_TOKEN".to_string(),
203+
Secret::new("veryverysecret".to_string()),
204+
),
205+
]));
206+
let settings = get_production_configuration(&secrets)?;
207+
assert_eq!(settings.email_client.sender_email, "noreply@queens.ac");
208+
assert_eq!(settings.email_client.timeout_seconds, 10);
209+
Ok(())
210+
}
191211
}

0 commit comments

Comments
 (0)