diff options
| author | mo khan <mo@mokhan.ca> | 2025-06-25 15:42:20 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-06-25 15:42:20 -0600 |
| commit | 790b5d5e51c64e56bba876978ebb9970b0ce0f03 (patch) | |
| tree | 01e57a72b9fc8f52faf48efaefd548196d91333f | |
| parent | 13205895041cc545a41be9552fe28d5dc1c7318a (diff) | |
test: use build_header function
| -rw-r--r-- | tests/common/factory_bot.rs | 6 | ||||
| -rw-r--r-- | tests/integration_tests.rs | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/tests/common/factory_bot.rs b/tests/common/factory_bot.rs index a16a1213..f25633f4 100644 --- a/tests/common/factory_bot.rs +++ b/tests/common/factory_bot.rs @@ -42,12 +42,6 @@ pub fn build_headers(headers: Vec<(String, String)>) -> HashMap<String, String> }); } -pub fn create_headers_with_auth(auth_value: &str) -> HashMap<String, String> { - return build_with(|item: &mut HashMap<String, String>| { - item.insert(String::from("authorization"), String::from(auth_value)); - }); -} - pub fn create_token() -> String { return String::from("valid-token"); } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 41c3bf29..c25d1920 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -39,7 +39,10 @@ async fn test_multiple() { ]; for (auth_value, should_succeed) in test_cases { - let headers = common::factory_bot::create_headers_with_auth(auth_value); + let headers = common::factory_bot::build_headers(vec![( + "authorization".to_string(), + auth_value.to_string(), + )]); let request = common::factory_bot::create_test_request_with_headers(headers); let response = server.check(request).await; |
