use rusty_falcon::apis::configuration;
use serde_json::Value;
use wiremock::{
Mock, MockServer, ResponseTemplate,
http::Method,
matchers::{method, path},
};
pub async fn setup_mock(
http_method: Method,
endpoint_path: &str,
status_code: u16,
response_body: Value,
) -> MockServer {
let mock_server = MockServer::start().await;
Mock::given(method(http_method.as_str()))
.and(path(endpoint_path))
.respond_with(ResponseTemplate::new(status_code).set_body_json(response_body))
.mount(&mock_server)
.await;
mock_server
}
pub fn create_test_config(mock_server: &MockServer) -> configuration::Configuration {
let mut config = configuration::Configuration::default();
config.base_path = mock_server.uri();
config
}