style: format proxmox client code with cargo fmt
Some checks failed
PR Review Automation / review (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Successful in 1m46s
Test / frontend-typecheck (pull_request) Successful in 1m53s
Test / rust-fmt-check (pull_request) Successful in 12m1s
Test / rust-clippy (pull_request) Successful in 13m25s
Test / rust-tests (pull_request) Successful in 15m37s
Some checks failed
PR Review Automation / review (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Successful in 1m46s
Test / frontend-typecheck (pull_request) Successful in 1m53s
Test / rust-fmt-check (pull_request) Successful in 12m1s
Test / rust-clippy (pull_request) Successful in 13m25s
Test / rust-tests (pull_request) Successful in 15m37s
This commit is contained in:
parent
cec962b349
commit
bad3042d2d
@ -349,7 +349,7 @@ mod tests {
|
|||||||
fn test_auth_response_envelope_deserialization() {
|
fn test_auth_response_envelope_deserialization() {
|
||||||
// Validates that the `{"data": {...}}` envelope Proxmox uses is parsed
|
// Validates that the `{"data": {...}}` envelope Proxmox uses is parsed
|
||||||
// correctly into ProxmoxEnvelope<AuthResponse>.
|
// correctly into ProxmoxEnvelope<AuthResponse>.
|
||||||
// Note: Proxmox returns lowercase fields (ticket, username, clustername)
|
// Note: Proxmox returns lowercase fields (ticket, username, clustername)
|
||||||
// except for CSRFPreventionToken which is PascalCase.
|
// except for CSRFPreventionToken which is PascalCase.
|
||||||
let json = r#"{
|
let json = r#"{
|
||||||
"data": {
|
"data": {
|
||||||
@ -431,7 +431,7 @@ mod tests {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam");
|
let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam");
|
||||||
let result = client.authenticate(&password).await;
|
let result = client.authenticate(&password).await;
|
||||||
match result {
|
match result {
|
||||||
@ -456,9 +456,12 @@ mod tests {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam");
|
let mut client = ProxmoxClient::new("172.0.0.18", 8006, "root@pam");
|
||||||
client.authenticate(&password).await.expect("Authentication failed");
|
client
|
||||||
|
.authenticate(&password)
|
||||||
|
.await
|
||||||
|
.expect("Authentication failed");
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
struct Resource {
|
struct Resource {
|
||||||
@ -470,7 +473,9 @@ mod tests {
|
|||||||
status: Option<String>,
|
status: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
let result: Result<Vec<Resource>, _> = client.get("cluster/resources", client.ticket.as_deref()).await;
|
let result: Result<Vec<Resource>, _> = client
|
||||||
|
.get("cluster/resources", client.ticket.as_deref())
|
||||||
|
.await;
|
||||||
match result {
|
match result {
|
||||||
Ok(resources) => {
|
Ok(resources) => {
|
||||||
println!("✓ Cluster resources fetched successfully");
|
println!("✓ Cluster resources fetched successfully");
|
||||||
@ -496,9 +501,12 @@ mod tests {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
|
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
|
||||||
client.authenticate(&password).await.expect("Authentication failed");
|
client
|
||||||
|
.authenticate(&password)
|
||||||
|
.await
|
||||||
|
.expect("Authentication failed");
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
struct Node {
|
struct Node {
|
||||||
@ -535,9 +543,12 @@ mod tests {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
|
let mut client = ProxmoxClient::new("proxmox-server", 8006, "root@pam");
|
||||||
client.authenticate(&password).await.expect("Authentication failed");
|
client
|
||||||
|
.authenticate(&password)
|
||||||
|
.await
|
||||||
|
.expect("Authentication failed");
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
struct Resource {
|
struct Resource {
|
||||||
@ -548,10 +559,15 @@ mod tests {
|
|||||||
status: Option<String>,
|
status: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
let result: Result<Vec<Resource>, _> = client.get("cluster/resources", client.ticket.as_deref()).await;
|
let result: Result<Vec<Resource>, _> = client
|
||||||
|
.get("cluster/resources", client.ticket.as_deref())
|
||||||
|
.await;
|
||||||
match result {
|
match result {
|
||||||
Ok(resources) => {
|
Ok(resources) => {
|
||||||
let vms: Vec<_> = resources.into_iter().filter(|r| r.r#type.as_deref() == Some("qemu")).collect();
|
let vms: Vec<_> = resources
|
||||||
|
.into_iter()
|
||||||
|
.filter(|r| r.r#type.as_deref() == Some("qemu"))
|
||||||
|
.collect();
|
||||||
println!("✓ VMs fetched successfully");
|
println!("✓ VMs fetched successfully");
|
||||||
println!(" Found {} VMs", vms.len());
|
println!(" Found {} VMs", vms.len());
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user