-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -448,14 +448,14 @@ async fn cdx_generated_from(ctx: &TrustifyContext) -> Result<(), anyhow::Error> | |
.iter() | ||
.filter(|i| i["node_id"] == src) | ||
.flat_map(|i| i["descendants"].as_array().unwrap().iter()) | ||
.filter(|d| d["relationship"] == "generated_from") | ||
.filter(|d| d["relationship"] == "generates") | ||
.count() | ||
); | ||
|
||
// Ensure binary rpm GeneratedFrom src rpm | ||
let x86 = "pkg:rpm/redhat/[email protected]_2?arch=x86_64"; | ||
let uri = format!( | ||
"/api/v2/analysis/root-component/{}", | ||
"/api/v2/analysis/component/{}?ancestors=10", | ||
urlencoding::encode(x86) | ||
); | ||
let request: Request = TestRequest::get().uri(&uri).to_request(); | ||
|
@@ -465,7 +465,7 @@ async fn cdx_generated_from(ctx: &TrustifyContext) -> Result<(), anyhow::Error> | |
"items": [{ | ||
"purl": [ x86 ], | ||
"ancestors": [{ | ||
"relationship": "GeneratedFrom", | ||
"relationship": "geneartes", | ||
"purl": [ src ] | ||
}] | ||
}] | ||
|
@@ -483,7 +483,10 @@ async fn spdx_generated_from(ctx: &TrustifyContext) -> Result<(), anyhow::Error> | |
|
||
// Find all deps of src rpm | ||
let src = "pkg:rpm/redhat/[email protected]_2?arch=src"; | ||
let uri = format!("/api/v2/analysis/dep/{}", urlencoding::encode(src)); | ||
let uri = format!( | ||
"/api/v2/analysis/component/{}?descendants=10", | ||
urlencoding::encode(src) | ||
); | ||
let request: Request = TestRequest::get().uri(&uri).to_request(); | ||
let response: Value = app.call_and_read_body_json(request).await; | ||
log::debug!("{response:#?}"); | ||
|
@@ -496,24 +499,25 @@ async fn spdx_generated_from(ctx: &TrustifyContext) -> Result<(), anyhow::Error> | |
.iter() | ||
.filter(|i| i["node_id"] == "SPDXRef-SRPM") | ||
.flat_map(|i| i["descendants"].as_array().unwrap().iter()) | ||
.filter(|d| d["relationship"] == "GeneratedFrom") | ||
.filter(|d| d["relationship"] == "generates") | ||
.count() | ||
); | ||
|
||
// Ensure binary rpm GeneratedFrom src rpm | ||
let x86 = "pkg:rpm/redhat/[email protected]_2?arch=x86_64"; | ||
let uri = format!( | ||
"/api/v2/analysis/root-component/{}", | ||
"/api/v2/analysis/component/{}?ancestors=10", | ||
urlencoding::encode(x86) | ||
); | ||
let request: Request = TestRequest::get().uri(&uri).to_request(); | ||
let response: Value = app.call_and_read_body_json(request).await; | ||
log::debug!("{response:#?}"); | ||
|
||
assert!(response.contains_subset(json!({ | ||
"items": [{ | ||
"purl": [ x86 ], | ||
"ancestors": [{ | ||
"relationship": "GeneratedFrom", | ||
"relationship": "generates", | ||
"purl": [ src ] | ||
}] | ||
}] | ||
|
@@ -534,7 +538,7 @@ async fn cdx_variant_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
let child = "pkg:oci/openshift-ose-console@sha256:94a0d7feec34600a858c8e383ee0e8d5f4a077f6bbc327dcad8762acfcf40679"; | ||
|
||
let uri = format!( | ||
"/api/v2/analysis/component/{}?descendants=10", | ||
"/api/v2/analysis/component/{}?ancestors=10", | ||
urlencoding::encode(parent) | ||
); | ||
let request: Request = TestRequest::get().uri(&uri).to_request(); | ||
|
@@ -544,7 +548,7 @@ async fn cdx_variant_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
assert!(response.contains_subset(json!({ | ||
"items": [{ | ||
"purl": [ parent ], | ||
"descendants": [{ | ||
"ancestors": [{ | ||
"relationship": "variant", | ||
"purl": [ child ] | ||
}] | ||
|
@@ -553,7 +557,7 @@ async fn cdx_variant_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
|
||
// Ensure child is variant of src | ||
let uri = format!( | ||
"/api/v2/analysis/component/{}?ancestors=10", | ||
"/api/v2/analysis/component/{}?descendants=10", | ||
urlencoding::encode(child) | ||
); | ||
let request: Request = TestRequest::get().uri(&uri).to_request(); | ||
|
@@ -563,7 +567,7 @@ async fn cdx_variant_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
assert!(response.contains_subset(json!({ | ||
"items": [{ | ||
"purl": [ child ], | ||
"ancestors": [{ | ||
"descendants": [{ | ||
"relationship": "variant", | ||
"purl": [ parent ] | ||
}] | ||
|
@@ -769,7 +773,7 @@ async fn spdx_package_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
assert!(response.contains_subset(json!({ | ||
"items": [ { | ||
"ancestors": [ { | ||
"relationship": "packages", | ||
"relationship": "package", | ||
"name": "SATELLITE-6.15-RHEL-8", | ||
"version": "6.15", | ||
}] | ||
|
@@ -788,7 +792,7 @@ async fn spdx_package_of(ctx: &TrustifyContext) -> Result<(), anyhow::Error> { | |
assert!(response.contains_subset(json!({ | ||
"items": [ { | ||
"descendants": [ { | ||
"relationship": "packages", | ||
"relationship": "package", | ||
"name": "rubygem-google-cloud-compute", | ||
"version": "0.5.0-1.el8sat" | ||
}] | ||
|