Skip to content

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

chore(http): remove outdated dictation WebSocket tests

Steven Enamakeled5ef6fd6496
diff --git a/crates/openhuman-rpc/src/server/http/dictation.rs b/crates/openhuman-rpc/src/server/http/dictation.rs
index ecff7e9acc..c28cf2435f 100644
--- a/crates/openhuman-rpc/src/server/http/dictation.rs
+++ b/crates/openhuman-rpc/src/server/http/dictation.rs
@@ -97,7 +97,3 @@ pub(super) async fn dictation_ws_handler(
openhuman_core::voice::streaming::handle_dictation_ws(socket, config).await;
})
}
-
-#[cfg(test)]
-#[path = "dictation_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-rpc/src/server/http/dictation_tests.rs b/crates/openhuman-rpc/src/server/http/dictation_tests.rs
deleted file mode 100644
index 7fab78de03..0000000000
--- a/crates/openhuman-rpc/src/server/http/dictation_tests.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use axum::body::{to_bytes, Body};
-use axum::http::{header, Request, StatusCode};
-use axum::routing::get;
-use axum::Router;
-use tower::ServiceExt;
-
-use super::dictation_ws_handler;
-
-fn upgrade_request(uri: &str, origin: Option<&str>) -> Request<Body> {
- let mut builder = Request::builder()
- .uri(uri)
- .header(header::CONNECTION, "Upgrade")
- .header(header::UPGRADE, "websocket")
- .header("sec-websocket-version", "13")
- .header("sec-websocket-key", "dGhlIHNhbXBsZSBub25jZQ==");
- if let Some(origin) = origin {
- builder = builder.header(header::ORIGIN, origin);
- }
- builder.body(Body::empty()).unwrap()
-}
-
-async fn dispatch(request: Request<Body>) -> axum::response::Response {
- Router::new()
- .route("/ws/dictation", get(dictation_ws_handler))
- .oneshot(request)
- .await
- .unwrap()
-}
-
-#[tokio::test]
-async fn dictation_rejects_foreign_browser_origins_before_authentication() {
- let response = dispatch(upgrade_request(
- "/ws/dictation?token=not-a-bearer",
- Some("https://attacker.example"),
- ))
- .await;
- assert_eq!(response.status(), StatusCode::FORBIDDEN);
- let body = to_bytes(response.into_body(), usize::MAX).await.unwrap();
- assert!(String::from_utf8_lossy(&body).contains("Origin not allowed"));
-}
-
-#[tokio::test]
-async fn dictation_rejects_missing_and_invalid_credentials() {
- for uri in ["/ws/dictation", "/ws/dictation?token=not-a-bearer"] {
- let response = dispatch(upgrade_request(uri, None)).await;
- assert_eq!(response.status(), StatusCode::UNAUTHORIZED);
- let body = to_bytes(response.into_body(), usize::MAX).await.unwrap();
- assert!(String::from_utf8_lossy(&body).contains("Missing or invalid token"));
- }
-}