feat: add first test with tokio dev-dep

This commit is contained in:
rzmk 2025-05-27 14:09:16 -04:00
parent c8f9d66b04
commit 66b28fd3f9
3 changed files with 103 additions and 2 deletions

26
tests/general.rs Normal file
View file

@ -0,0 +1,26 @@
use ckanaction::CKAN;
const CKAN_API_TOKEN: &str = "";
const CKAN_URL: &str = "";
pub async fn get_ckan_builder() -> CKAN {
CKAN::builder()
.token(CKAN_API_TOKEN.to_string())
.url(CKAN_URL)
.build()
}
#[cfg(test)]
mod tests {
use super::*;
#[tokio::test]
async fn status_show() -> Result<(), Box<dyn std::error::Error>> {
let ckan = get_ckan_builder().await;
let response = ckan.status_show().await?;
assert!(response.is_object());
let success = response.as_object().unwrap().get("success").unwrap().as_bool().unwrap();
assert!(success);
Ok(())
}
}