use guac::client::intrinsic::vulnerability::{IDorVulnerabilityInput, VulnerabilityInputSpec, VulnerabilitySpec}; use guac::client::GuacClient; use crate::common::guac_url; mod common; #[tokio::test] async fn vulnerability() -> Result<(), anyhow::Error> { let client = GuacClient::new(&guac_url()); let _result = client .intrinsic() .ingest_vulnerability(&IDorVulnerabilityInput { vulnerability_input: Some(VulnerabilityInputSpec { r#type: "NOT-test-vuln".to_string(), vulnerability_id: "ghsa-osv-cve-44".to_string(), }), vulnerability_type_id: None, vulnerability_node_id: None, }) .await?; let _result = client .intrinsic() .ingest_vulnerability(&IDorVulnerabilityInput { vulnerability_input: Some(VulnerabilityInputSpec { r#type: "test-vuln".to_string(), vulnerability_id: "ghsa-osv-cve-44".to_string(), }), vulnerability_type_id: None, vulnerability_node_id: None, }) .await?; let result = client .intrinsic() .vulnerabilities(&VulnerabilitySpec { r#type: Some("test-vuln".to_string()), ..Default::default() }) .await?; assert_eq!(1, result.len()); assert_eq!("test-vuln".to_string(), result[0].r#type); assert_eq!( "ghsa-osv-cve-44".to_string(), result[0].vulnerability_ids[0].vulnerability_id ); Ok(()) }