diff --git a/rust/agama-server/src/web/common.rs b/rust/agama-server/src/web/common.rs index 5484111121..eb4cd431b6 100644 --- a/rust/agama-server/src/web/common.rs +++ b/rust/agama-server/src/web/common.rs @@ -138,7 +138,7 @@ async fn build_service_status_proxy<'a>( /// ).await.unwrap(); /// let router: Router = Router::new() /// .route("/hello", get(hello)) -/// .merge(progress) +/// .merge(progress_router) /// .with_state(HelloWorldState {}); /// }); /// ``` @@ -238,7 +238,7 @@ async fn build_progress_proxy<'a>( /// ```no_run /// # use axum::{extract::State, routing::get, Json, Router}; /// # use agama_lib::connection; -/// # use agama_server::web::common::service_status_router; +/// # use agama_server::web::common::{issues_router, service_status_router}; /// # use tokio_test; /// /// # tokio_test::block_on(async { diff --git a/rust/agama-server/tests/network.rs b/rust/agama-server/tests/network.rs index e437331d9d..7413e20ac8 100644 --- a/rust/agama-server/tests/network.rs +++ b/rust/agama-server/tests/network.rs @@ -8,7 +8,7 @@ use agama_lib::network::{ }; use agama_server::network::{ self, - model::{self, Ipv4Method, Ipv6Method}, + model::{self, GeneralState, Ipv4Method, Ipv6Method, NetworkStateItems}, Adapter, NetworkAdapterError, NetworkService, NetworkState, }; use async_trait::async_trait; @@ -21,7 +21,10 @@ pub struct NetworkTestAdapter(network::NetworkState); #[async_trait] impl Adapter for NetworkTestAdapter { - async fn read(&self) -> Result { + async fn read( + &self, + _: Vec, + ) -> Result { Ok(self.0.clone()) } @@ -34,12 +37,18 @@ impl Adapter for NetworkTestAdapter { async fn test_read_connections() -> Result<(), Box> { let mut server = DBusServer::new().start().await?; + let general_state = GeneralState { + wireless_enabled: false, + connectivity: true, + networking_enabled: true, + }; + let device = model::Device { name: String::from("eth0"), type_: DeviceType::Ethernet, }; let eth0 = model::Connection::new("eth0".to_string(), DeviceType::Ethernet); - let state = NetworkState::new(vec![device], vec![eth0]); + let state = NetworkState::new(general_state, vec![], vec![device], vec![eth0]); let adapter = NetworkTestAdapter(state); NetworkService::start(&server.connection(), adapter).await?; @@ -143,12 +152,18 @@ async fn test_add_bond_connection() -> Result<(), Box> { async fn test_update_connection() -> Result<(), Box> { let mut server = DBusServer::new().start().await?; + let general_state = GeneralState { + wireless_enabled: false, + connectivity: true, + networking_enabled: true, + }; + let device = model::Device { name: String::from("eth0"), type_: DeviceType::Ethernet, }; let eth0 = model::Connection::new("eth0".to_string(), DeviceType::Ethernet); - let state = NetworkState::new(vec![device], vec![eth0]); + let state = NetworkState::new(general_state, vec![], vec![device], vec![eth0]); let adapter = NetworkTestAdapter(state); NetworkService::start(&server.connection(), adapter).await?;