#[cfg(feature = "async")]
mod async_methods_tests {
use gouqi::r#async::Jira;
use gouqi::{Credentials, Result};
#[tokio::test]
async fn test_search_method() -> Result<()> {
let jira = Jira::new("http://example.com", Credentials::Anonymous)?;
let _search = jira.search();
Ok(())
}
#[tokio::test]
async fn test_issues_method() -> Result<()> {
let jira = Jira::new("http://example.com", Credentials::Anonymous)?;
let _issues = jira.issues();
Ok(())
}
#[tokio::test]
async fn test_from_client_method() -> Result<()> {
let client = reqwest::Client::new();
let _jira = Jira::from_client("http://example.com", Credentials::Anonymous, client)?;
Ok(())
}
#[tokio::test]
async fn test_http_methods() -> Result<()> {
let jira = Jira::new("http://localhost:54321", Credentials::Anonymous)?;
let get_result = jira.get::<serde_json::Value>("api", "/endpoint").await;
assert!(get_result.is_err());
let post_result = jira
.post::<serde_json::Value, serde_json::Value>("api", "/endpoint", serde_json::json!({}))
.await;
assert!(post_result.is_err());
let put_result = jira
.put::<serde_json::Value, serde_json::Value>("api", "/endpoint", serde_json::json!({}))
.await;
assert!(put_result.is_err());
let delete_result = jira.delete::<serde_json::Value>("api", "/endpoint").await;
assert!(delete_result.is_err());
Ok(())
}
}