Skip to content

Commit

Permalink
backen: fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreddow committed Dec 18, 2024
1 parent 7a5a06d commit 5800f7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/src/rate_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ impl LoginRateLimiter {
let ip = if let Some(ip) = req.connection_info().realip_remote_addr() {
ip.to_string()
} else {
println!("No ip found for route {}", req.path());
return Err(crate::error::Error::InternalError.into());
};

Expand Down
5 changes: 5 additions & 0 deletions backend/src/routes/auth/get_login_salt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub mod tests {

let req = TestRequest::get()
.uri(&format!("/get_login_salt?email={}", mail))
.append_header(("X-Forwarded-For", "123.123.123.2"))
.to_request();
let resp = test::call_and_read_body_json(&app, req).await;

Expand All @@ -101,6 +102,7 @@ pub mod tests {

let req = test::TestRequest::get()
.uri(&format!("/get_login_salt?email={}", mail))
.append_header(("X-Forwarded-For", "123.123.123.2"))
.to_request();
let resp = test::call_service(&app, req).await;
println!("{}", resp.status());
Expand Down Expand Up @@ -128,6 +130,7 @@ pub mod tests {

let req = test::TestRequest::get()
.uri(&format!("/get_login_salt?email={}", mail))
.append_header(("X-Forwarded-For", "123.123.123.2"))
.to_request();
let resp = test::call_service(&app, req).await;
assert!(resp.status().is_success());
Expand All @@ -137,6 +140,7 @@ pub mod tests {

let req = test::TestRequest::get()
.uri(&format!("/get_login_salt?email={}", mail))
.append_header(("X-Forwarded-For", "123.123.123.2"))
.to_request();
let resp = test::call_service(&app, req).await;
assert!(resp.status().is_success());
Expand All @@ -146,6 +150,7 @@ pub mod tests {
let mail = format!("{}@example.invalid", uuid::Uuid::new_v4().to_string());
let req = test::TestRequest::get()
.uri(&format!("/get_login_salt?email={}", mail))
.append_header(("X-Forwarded-For", "123.123.123.2"))
.to_request();
let resp = test::call_service(&app, req).await;
assert!(resp.status().is_success());
Expand Down

0 comments on commit 5800f7d

Please sign in to comment.