diff --git a/src/api/adapter/local.rs b/src/api/adapter/local.rs index 958d485c..07698d73 100644 --- a/src/api/adapter/local.rs +++ b/src/api/adapter/local.rs @@ -12,8 +12,7 @@ use crate::data::{ ActiveMock, ClosestMatch, MockDefinition, MockIdentification, RequestRequirements, }; use crate::server::web::handlers::{ - add_new_mock, delete_all_mocks, delete_history, delete_one_mock, - verify, read_one_mock, + add_new_mock, delete_all_mocks, delete_history, delete_one_mock, read_one_mock, verify, }; use crate::server::MockServerState; @@ -74,10 +73,7 @@ impl MockServerAdapter for LocalMockServerAdapter { Ok(()) } - async fn verify( - &self, - mock_rr: &RequestRequirements, - ) -> Result, String> { + async fn verify(&self, mock_rr: &RequestRequirements) -> Result, String> { verify(&self.local_state, mock_rr) } diff --git a/src/api/adapter/mod.rs b/src/api/adapter/mod.rs index f1f5f3d6..f55d2f05 100644 --- a/src/api/adapter/mod.rs +++ b/src/api/adapter/mod.rs @@ -12,8 +12,7 @@ use crate::data::{ ActiveMock, ClosestMatch, MockDefinition, MockIdentification, RequestRequirements, }; use crate::server::web::handlers::{ - add_new_mock, delete_all_mocks, delete_history, delete_one_mock, - verify, read_one_mock, + add_new_mock, delete_all_mocks, delete_history, delete_one_mock, read_one_mock, verify, }; use crate::server::{Mismatch, MockServerState}; @@ -79,10 +78,7 @@ pub trait MockServerAdapter { async fn fetch_mock(&self, mock_id: usize) -> Result; async fn delete_mock(&self, mock_id: usize) -> Result<(), String>; async fn delete_all_mocks(&self) -> Result<(), String>; - async fn verify( - &self, - rr: &RequestRequirements, - ) -> Result, String>; + async fn verify(&self, rr: &RequestRequirements) -> Result, String>; async fn delete_history(&self) -> Result<(), String>; async fn ping(&self) -> Result<(), String>; } diff --git a/src/api/adapter/standalone.rs b/src/api/adapter/standalone.rs index 150a0900..058614fa 100644 --- a/src/api/adapter/standalone.rs +++ b/src/api/adapter/standalone.rs @@ -172,10 +172,7 @@ impl MockServerAdapter for RemoteMockServerAdapter { Ok(()) } - async fn verify( - &self, - mock_rr: &RequestRequirements, - ) -> Result, String> { + async fn verify(&self, mock_rr: &RequestRequirements) -> Result, String> { // Serialize to JSON let json = match serde_json::to_string(mock_rr) { Err(err) => return Err(format!("Cannot serialize mock object to JSON: {}", err)), diff --git a/src/api/mock.rs b/src/api/mock.rs index 71893482..c41580bf 100644 --- a/src/api/mock.rs +++ b/src/api/mock.rs @@ -208,11 +208,9 @@ impl<'a> MockRef<'a> { if active_mock.call_counter > hits { assert_eq!( - active_mock.call_counter, - hits, + active_mock.call_counter, hits, "The number of matching requests was higher than expected (expected {} but was {})", - hits, - active_mock.call_counter + hits, active_mock.call_counter ) } diff --git a/src/server/mod.rs b/src/server/mod.rs index a4f89d97..d534a8ee 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -568,10 +568,7 @@ mod test { assert_eq!(PING_PATH.is_match("test/ping/1295473892374"), false); assert_eq!(VERIFY_PATH.is_match("/__verify"), true); - assert_eq!( - VERIFY_PATH.is_match("/__verify/1295473892374"), - false - ); + assert_eq!(VERIFY_PATH.is_match("/__verify/1295473892374"), false); assert_eq!(VERIFY_PATH.is_match("test/verify/1295473892374"), false); assert_eq!(HISTORY_PATH.is_match("/__history"), true); diff --git a/src/server/web/handlers.rs b/src/server/web/handlers.rs index 31fef053..c87e02b4 100644 --- a/src/server/web/handlers.rs +++ b/src/server/web/handlers.rs @@ -251,8 +251,7 @@ mod test { HttpMockRequest, MockDefinition, MockServerHttpResponse, Pattern, RequestRequirements, }; use crate::server::web::handlers::{ - add_new_mock, verify, read_one_mock, request_matches, - validate_mock_definition, + add_new_mock, read_one_mock, request_matches, validate_mock_definition, verify, }; use crate::server::MockServerState; use crate::Method; diff --git a/src/server/web/routes.rs b/src/server/web/routes.rs index 196d6e5d..d94c678a 100644 --- a/src/server/web/routes.rs +++ b/src/server/web/routes.rs @@ -69,10 +69,7 @@ pub(crate) fn read_one(state: &MockServerState, id: usize) -> Result Result { +pub(crate) fn verify(state: &MockServerState, body: String) -> Result { let mock_rr: serde_json::Result = serde_json::from_str(&body); if let Err(e) = mock_rr { return create_json_response(500, None, ErrorResponse::new(&e));