use mockito::{mock, server_url};
use proxctl_bindings::ProxmoxApi;
#[tokio::test]
async fn test_get_node_list() {
let _m = mock("GET", "/api2/json/nodes")
.with_status(200)
.with_body(r#"{"data": [{"node": "node1", "status": "online"}]}"#)
.create();
let proxmox_api = ProxmoxApi::new(server_url());
let response = proxmox_api.get_node_list().await.unwrap();
assert_eq!(response.data.len(), 1);
assert_eq!(response.data[0].node, "node1");
assert_eq!(response.data[0].status, "online");
}
#[tokio::test]
async fn test_get_node_status() {
let _m = mock("GET", "/api2/json/nodes/node1/status")
.with_status(200)
.with_body(r#"online"#)
.create();
let proxmox_api = ProxmoxApi::new(server_url());
let response = proxmox_api.get_node_status("node1").await.unwrap();
assert_eq!(response, "online");
}