Skip to content

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

chore(core): add tests for channel routes and approval flow

Steven Enamakel7cad5f41a12c
diff --git a/crates/openhuman-core/src/channels/routes_tests.rs b/crates/openhuman-core/src/channels/routes_tests.rs
index 57dabaf812..421a578253 100644
--- a/crates/openhuman-core/src/channels/routes_tests.rs
+++ b/crates/openhuman-core/src/channels/routes_tests.rs
@@ -9,7 +9,7 @@ use std::collections::HashMap;
use std::future::Future;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
-use std::task::{Context, Poll, Wake, Waker};
+use std::task::{Context, Poll, Waker};
use tinybus::EventHandler;
use tinychannels::routes::resolve_provider_alias;
use tinychannels_bus::context::ChatMessage;
@@ -238,12 +238,6 @@ fn model_command_messages_use_thread_aware_history_keys() {
);
}
-struct NoopWake;
-
-impl Wake for NoopWake {
- fn wake(self: Arc<Self>) {}
-}
-
#[cfg(feature = "modules")]
#[tokio::test]
async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_table() {
@@ -269,7 +263,7 @@ async fn sign_out_cancels_remote_invalidation_while_it_waits_for_the_session_tab
},
);
let mut operation = Box::pin(callback.dispatch_controller_backend(request));
- let waker = Waker::from(Arc::new(NoopWake));
+ let waker = Waker::noop().clone();
let mut task_context = Context::from_waker(&waker);
assert!(
diff --git a/crates/openhuman-core/src/hosting/mod.rs b/crates/openhuman-core/src/hosting/mod.rs
index 9ec028f053..ede109edfd 100644
--- a/crates/openhuman-core/src/hosting/mod.rs
+++ b/crates/openhuman-core/src/hosting/mod.rs
@@ -30,8 +30,7 @@ pub struct Account {
workspace_dir: PathBuf,
providers_loaded: Arc<tokio::sync::OnceCell<()>>,
#[cfg(test)]
- call_fixture:
- Option<Arc<dyn Fn(&str, serde_json::Value, bool) -> anyhow::Result<String> + Send + Sync>>,
+ call_fixture: Option<CallFixture>,
}
impl std::fmt::Debug for Account {
diff --git a/crates/openhuman-core/src/security/approval/flow_surface_tests.rs b/crates/openhuman-core/src/security/approval/flow_surface_tests.rs
index 9f6233bfd6..687276868c 100644
--- a/crates/openhuman-core/src/security/approval/flow_surface_tests.rs
+++ b/crates/openhuman-core/src/security/approval/flow_surface_tests.rs
@@ -2,12 +2,7 @@ use super::*;
use std::cell::Cell;
use std::future::Future;
use std::sync::Arc;
-use std::task::{Context, Poll, Wake, Waker};
-
-struct Noop;
-impl Wake for Noop {
- fn wake(self: Arc<Self>) {}
-}
+use std::task::{Context, Poll, Waker};
#[test]
fn a_closed_instance_registers_nothing_and_publishes_neither_flow_surface() {
@@ -19,7 +14,7 @@ fn a_closed_instance_registers_nothing_and_publishes_neither_flow_surface() {
std::future::ready(17),
|_| publications.set(publications.get() + 1),
));
- let waker = Waker::from(Arc::new(Noop));
+ let waker = Waker::noop().clone();
assert_eq!(
publication.as_mut().poll(&mut Context::from_waker(&waker)),
Poll::Ready(Err("agent_removed".to_owned()))
@@ -42,7 +37,7 @@ fn removal_during_workspace_lookup_suppresses_registration_and_all_surfaces() {
let mut publication = std::pin::pin!(register_after_workspace(Some(&scope), workspace, |_| {
publications.set(publications.get() + 1)
},));
- let waker = Waker::from(Arc::new(Noop));
+ let waker = Waker::noop().clone();
let mut cx = Context::from_waker(&waker);
assert_eq!(publication.as_mut().poll(&mut cx), Poll::Pending);
assert_eq!(
@@ -73,7 +68,7 @@ fn a_live_or_unscoped_flow_registers_once_with_its_resolved_workspace() {
42
},
));
- let waker = Waker::from(Arc::new(Noop));
+ let waker = Waker::noop().clone();
assert_eq!(
publication.as_mut().poll(&mut Context::from_waker(&waker)),
Poll::Ready(Ok(42))