use crate::helpers::client::AgentClient; use serde_json::json; use uuid::Uuid; type TestResult = Result>; async fn register_agent() -> Uuid { let cli = AgentClient::new(); let agent_uid = Uuid::new_v4(); let resp = cli.get(format!("get_agent_jobs/{}", agent_uid)).await; let job_id = &resp["job_id"]; let resp = cli.get(format!("get_jobs/{}", job_id)).await; assert_eq!(&resp["alias"], "agent_hello"); let agent_data = json! { {"id": &agent_uid,"inner":[ {"Agent": {"alias":null, "hostname":"3b1030fa6324", "id":&agent_uid, "is_root":false, "is_root_allowed":false, "last_active":{"secs_since_epoch":1625271265,"nanos_since_epoch":92814921}, "platform":"x86_64-unknown-linux-gnu", "regtime":{"secs_since_epoch":1625271265,"nanos_since_epoch":92814945}, "state":"New", "token":null, "username":"root"} }]} }; cli.post("report", &agent_data).await; agent_uid } #[tokio::test] async fn test_first_connection() -> TestResult { register_agent().await; Ok(()) }