Skip to content

Commit

Permalink
Add config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sigaloid committed Dec 29, 2023
1 parent ce0c6ec commit 3a4a39f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,3 +243,28 @@ fn test_stats_collection_true() {
write("redlib.toml", config_to_write).unwrap();
assert!(get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_some());
}

#[test]
#[sealed_test]
fn test_stats_collection_false() {
let config_to_write = r#"REDLIB_DISABLE_STATS_COLLECTION = "0""#;
write("redlib.toml", config_to_write).unwrap();
assert!(get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_some());
}

#[test]
#[sealed_test]
fn test_stats_collection_env_var() {
let config_to_write = r#"REDLIB_DISABLE_STATS_COLLECTION = "1""#;
write("redlib.toml", config_to_write).unwrap();
assert!(get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_some());
}

#[test]
#[sealed_test]
fn test_pushshift() {
let config_to_write = r#"REDLIB_PUSHSHIFT_FRONTEND = "https://api.pushshift.io""#;
write("redlib.toml", config_to_write).unwrap();
assert!(get_setting("REDLIB_PUSHSHIFT_FRONTEND").is_some());
assert_eq!(get_setting("REDLIB_PUSHSHIFT_FRONTEND"), Some("https://api.pushshift.io".into()));
}

0 comments on commit 3a4a39f

Please sign in to comment.