Skip to content

Instantly share code, notes, and snippets.

@cuongld2
Created September 22, 2020 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongld2/0674da6c9a81163a080071bf0966dc01 to your computer and use it in GitHub Desktop.
Save cuongld2/0674da6c9a81163a080071bf0966dc01 to your computer and use it in GitHub Desktop.
Calling public struct
use search::SearchElement;
#[path="../src/models/search.rs"]
pub mod search;
use std;
#[tokio::test]
async fn call_api() -> Result<(), Box<dyn std::error::Error>> {
let res = reqwest::Client::builder()
.danger_accept_invalid_certs(true)
.build()
.unwrap()
.get("ssl_uncertificate")
.send().await?;
let json_value: Vec<SearchElement> = res.json().await?;
println!("{:?}",json_value);
for i in &json_value{
assert_eq!(i.auth_resource_path.is_empty(), false);
assert_eq!(i.field.is_empty(), false);
assert_eq!(i.id.is_empty(), false);
assert_eq!(i.project_id.is_empty(), false);
assert_eq!(i.typepp.is_empty(), false);
assert_eq!(i.value.is_empty(), false)
}
Ok(())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment