use rabbitmq_http_client::api::{Client, ClientBuilder};
use rabbitmq_http_client::commons::Password;
use crate::test_helpers::ENDPOINT;
#[tokio::test]
async fn test_async_client_with_password_type() {
let password = Password::from("guest");
let rc = Client::new(ENDPOINT, "guest", password);
let result = rc.list_nodes().await;
assert!(result.is_ok(), "list_nodes failed: {:?}", result.err());
let nodes = result.unwrap();
assert!(!nodes.is_empty());
}
#[tokio::test]
async fn test_async_client_with_password_username_and_password() {
let username = Password::from("guest");
let password = Password::from("guest");
let rc = Client::new(ENDPOINT, username, password);
let result = rc.overview().await;
assert!(result.is_ok(), "overview failed: {:?}", result.err());
}
#[tokio::test]
async fn test_async_client_builder_with_password_type() {
let password = Password::from("guest");
let rc = ClientBuilder::new()
.with_endpoint(ENDPOINT)
.with_basic_auth_credentials("guest", password)
.build()
.unwrap();
let result = rc.list_nodes().await;
assert!(result.is_ok(), "list_nodes failed: {:?}", result.err());
}