Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(security): update handler identity assertion in schemas tests

Steven Enamakel27c30153d6e2
diff --git a/crates/openhuman-core/src/security/encryption/schemas_tests.rs b/crates/openhuman-core/src/security/encryption/schemas_tests.rs
index 1c28df93f7..28d21846d5 100644
--- a/crates/openhuman-core/src/security/encryption/schemas_tests.rs
+++ b/crates/openhuman-core/src/security/encryption/schemas_tests.rs
@@ -1,11 +1,15 @@
use super::*;
-use crate::core::all::{assert_schema_controller_parity, ControllerParamContract};
+use crate::core::all::{
+ assert_schema_controller_parity, ControllerHandler, ControllerParamContract,
+};
#[test]
fn legacy_registered_handlers_keep_their_function_identity() {
let controllers = all_registered_controllers();
let schemas = all_controller_schemas();
+ let expected_handlers: [ControllerHandler; 2] = [handle_encrypt_secret, handle_decrypt_secret];
assert_eq!(controllers.len(), 2);
+ assert_eq!(controllers.len(), expected_handlers.len());
assert_eq!(schemas.len(), 2);
assert_eq!(
schemas
@@ -15,14 +19,9 @@ fn legacy_registered_handlers_keep_their_function_identity() {
["encrypt.secret", "decrypt.secret"]
);
assert_schema_controller_parity(&schemas, &controllers, "secret");
- assert!(std::ptr::fn_addr_eq(
- controllers[0].handler,
- handle_encrypt_secret
- ));
- assert!(std::ptr::fn_addr_eq(
- controllers[1].handler,
- handle_decrypt_secret
- ));
+ for (controller, expected) in controllers.iter().zip(expected_handlers) {
+ assert!(std::ptr::fn_addr_eq(controller.handler, expected));
+ }
}
pub(super) fn parameter_contracts() -> Vec<ControllerParamContract> {