diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-09-21 18:10:26 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-09-21 18:10:26 +0800 |
| commit | f271ca59abf8b3eba7db1788e38ea9efe739262a (patch) | |
| tree | dc9bf1f01ab6e6c889ce4eae07a10cd6e2d404b0 /crates/utils/tcp_connection/tcp_connection_test | |
| parent | c730a220232d6343e50aadc6d6c37b308215e401 (diff) | |
Complete Challenge
Diffstat (limited to 'crates/utils/tcp_connection/tcp_connection_test')
| -rw-r--r-- | crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs b/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs index ac57451..57d3819 100644 --- a/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs +++ b/crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs @@ -1,7 +1,4 @@ -use std::{ - env::{current_dir, set_current_dir}, - time::Duration, -}; +use std::{env::current_dir, time::Duration}; use tcp_connection::{ handle::{ClientHandle, ServerHandle}, @@ -18,7 +15,9 @@ impl ClientHandle<ExampleChallengeServerHandle> for ExampleChallengeClientHandle mut instance: ConnectionInstance, ) -> impl std::future::Future<Output = ()> + Send + Sync { async move { - // TODO :: Complete the implementation + let key = current_dir().unwrap().join("res").join("test_key"); + let result = instance.accept_challenge(key, "test_key").await.unwrap(); + assert_eq!(true, result); } } } @@ -30,7 +29,9 @@ impl ServerHandle<ExampleChallengeClientHandle> for ExampleChallengeServerHandle mut instance: ConnectionInstance, ) -> impl std::future::Future<Output = ()> + Send + Sync { async move { - // TODO :: Complete the implementation + let key_dir = current_dir().unwrap().join("res"); + let result = instance.challenge(key_dir).await.unwrap(); + assert_eq!(true, result); } } } @@ -39,9 +40,6 @@ impl ServerHandle<ExampleChallengeClientHandle> for ExampleChallengeServerHandle async fn test_connection_with_challenge_handle() -> Result<(), std::io::Error> { let host = "localhost"; - // Enter temp directory - set_current_dir(current_dir().unwrap().join(".temp/"))?; - // Server setup let Ok(server_target) = TcpServerTarget::< ExampleChallengeClientHandle, |
