summaryrefslogtreecommitdiff
path: root/crates/utils/tcp_connection/tcp_connection_test
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2025-10-30 09:21:24 +0800
committer魏曹先生 <1992414357@qq.com>2025-10-30 09:21:24 +0800
commitcc43704e7412ef82f6d41ba211b50e26307a3ddf (patch)
treef52402ba8103644320e02e30d73656545a6a4597 /crates/utils/tcp_connection/tcp_connection_test
parent50945b098e3f6ff16f3f4cf25c2835ddf1e7b3a8 (diff)
Return key ID along with challenge verification result
- Update challenge method to return (bool, String) tuple - Include key ID in both success and failure cases - Update tests to verify key ID matches expected value - Maintain same verification logic but provide additional context
Diffstat (limited to 'crates/utils/tcp_connection/tcp_connection_test')
-rw-r--r--crates/utils/tcp_connection/tcp_connection_test/src/test_challenge.rs9
1 files changed, 6 insertions, 3 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 2fc1a87..9327b3e 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
@@ -69,8 +69,9 @@ impl ServerHandle<ExampleChallengeClientHandle> for ExampleChallengeServerHandle
async fn process(mut instance: ConnectionInstance) {
// Challenge with correct key
let key_dir = current_dir().unwrap().join("res").join("key");
- let result = instance.challenge(key_dir).await.unwrap();
+ let (result, key_id) = instance.challenge(key_dir).await.unwrap();
assert!(result);
+ assert_eq!(key_id, "test_key");
// Send response
instance
@@ -80,8 +81,9 @@ impl ServerHandle<ExampleChallengeClientHandle> for ExampleChallengeServerHandle
// Challenge again
let key_dir = current_dir().unwrap().join("res").join("key");
- let result = instance.challenge(key_dir).await.unwrap();
+ let (result, key_id) = instance.challenge(key_dir).await.unwrap();
assert!(!result);
+ assert_eq!(key_id, "test_key");
// Send response
instance
@@ -91,8 +93,9 @@ impl ServerHandle<ExampleChallengeClientHandle> for ExampleChallengeServerHandle
// Challenge again
let key_dir = current_dir().unwrap().join("res").join("key");
- let result = instance.challenge(key_dir).await.unwrap();
+ let (result, key_id) = instance.challenge(key_dir).await.unwrap();
assert!(!result);
+ assert_eq!(key_id, "test_key__");
// Send response
instance