mirror of
https://github.com/dathere/ckanaction.git
synced 2025-11-09 14:19:49 +00:00
feat: add first test with tokio dev-dep
This commit is contained in:
parent
c8f9d66b04
commit
66b28fd3f9
3 changed files with 103 additions and 2 deletions
26
tests/general.rs
Normal file
26
tests/general.rs
Normal 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(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue