summaryrefslogtreecommitdiff
path: root/tests/authorization/server_test.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-06-27 15:02:17 -0600
committermo khan <mo@mokhan.ca>2025-06-27 15:02:17 -0600
commit7bda8947c80fc507b722f321977522bd50377c17 (patch)
tree4d458daffbe08fc9ae80d55c0bdd0f004ba65ad2 /tests/authorization/server_test.rs
parent22bd71354eafd9e7ef4d4579f9bf5e6181d44604 (diff)
test: move helpers to factory_bot module
Diffstat (limited to 'tests/authorization/server_test.rs')
-rw-r--r--tests/authorization/server_test.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/tests/authorization/server_test.rs b/tests/authorization/server_test.rs
index 40cc270f..55645dd4 100644
--- a/tests/authorization/server_test.rs
+++ b/tests/authorization/server_test.rs
@@ -1,8 +1,8 @@
#[cfg(test)]
mod tests {
+ use crate::support::factory_bot::*;
use std::net::SocketAddr;
use tokio::net::TcpListener;
- use tonic::transport::Channel;
async fn available_port() -> SocketAddr {
let listener = TcpListener::bind("127.0.0.1:0")
@@ -26,25 +26,11 @@ mod tests {
(addr, handle)
}
- async fn build_channel(addr: SocketAddr) -> Channel {
- Channel::from_shared(format!("http://{}", addr))
- .expect("Failed to create channel")
- .connect()
- .await
- .expect("Failed to connect to server")
- }
-
- async fn build_client<T, F>(addr: SocketAddr, f: F) -> T
- where
- F: FnOnce(Channel) -> T,
- {
- f(build_channel(addr).await)
- }
-
#[tokio::test]
async fn test_health_check_service() {
let (addr, server) = start_server().await;
- let mut client = build_client(addr, tonic_health::pb::health_client::HealthClient::new).await;
+ let mut client =
+ build_rpc_client(addr, tonic_health::pb::health_client::HealthClient::new).await;
let request = tonic::Request::new(tonic_health::pb::HealthCheckRequest {
service: String::new(),