MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / run_mock

Function run_mock

ch_11/src/profanity.rs:90–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

88 }
89
90 fn run_mock() -> OneshotHandler {
91 // SAFETY: This test runs single-threaded; no other threads access env vars.
92 unsafe {
93 env::set_var("API_LAYER_URL", "http://127.0.0.1:3030");
94 env::set_var("BAD_WORDS_API_KEY", "YES");
95 }
96
97 let socket = "127.0.0.1:3030"
98 .to_string()
99 .parse()
100 .expect("Not a valid address");
101 let mock = MockServer::new(socket);
102
103 mock.oneshot()
104 }
105
106 async fn censor_profane_words() {
107 let content = "This is a shitty sentence".to_string();

Callers 1

runFunction · 0.85

Calls 1

oneshotMethod · 0.80

Tested by

no test coverage detected