Skip to content

Commit

Permalink
test: assert some details of the ingested OSV
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Oct 4, 2024
1 parent 1b57cdf commit 2878a54
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions modules/fundamental/tests/advisory/osv/reingest.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use super::{twice, update_mark_fixed_again, update_unmark_fixed};
use test_context::test_context;
use test_log::test;
use trustify_module_fundamental::vulnerability::service::VulnerabilityService;
use trustify_common::purl::Purl;
use trustify_module_fundamental::{
purl::service::PurlService, vulnerability::service::VulnerabilityService,
};
use trustify_module_ingestor::common::Deprecation;
use trustify_test_context::TrustifyContext;

Expand Down Expand Up @@ -62,11 +65,37 @@ async fn withdrawn(ctx: &TrustifyContext) -> anyhow::Result<()> {

assert_eq!(v.advisories.len(), 2);

println!("{v:#?}");

assert_eq!(v.advisories[0].head.head.identifier, "RSEC-2023-6");
assert_eq!(v.advisories[1].head.head.identifier, "RSEC-2023-6");

// check status

let service = PurlService::new(ctx.db.clone());
let purls = service
.base_purls(Default::default(), Default::default(), ())
.await?;

println!("PURLs: {purls:#?}");

let purl = purls
.items
.iter()
.find(|purl| purl.head.purl.name == "commonmark")
.expect("must find one");

assert_eq!(
purl.head.purl,
Purl {
ty: "cran".to_string(),
namespace: None,
name: "commonmark".to_string(),
version: None,
qualifiers: Default::default(),
}
);

// TODO: check status via purl version ranges

// done

Ok(())
Expand Down

0 comments on commit 2878a54

Please sign in to comment.