MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / unset_and_set_api_key

Function unset_and_set_api_key

ch_11/src/config.rs:87–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85
86 #[test]
87 fn unset_and_set_api_key() {
88 // ENV VARIABLES ARE NOT SET
89 let result = std::panic::catch_unwind(|| Config::new());
90 assert!(result.is_err());
91
92 // NOW WE SET THEM
93 set_env();
94
95 let expected = Config {
96 log_level: "warn".to_string(),
97 port: 8080,
98 db_user: "user".to_string(),
99 db_password: "pass".to_string(),
100 db_host: "localhost".to_string(),
101 db_port: 5432,
102 db_name: "rustwebdev".to_string(),
103 };
104
105 let config = Config::new().unwrap();
106
107 assert_eq!(config, expected);
108 }
109}

Callers

nothing calls this directly

Calls 1

set_envFunction · 0.85

Tested by

no test coverage detected