Skip to content

Commit 5a36005

Browse files
mrizzihelio-frota
authored andcommitted
feat: add license filtering tests
Signed-off-by: mrizzi <mrizzi@redhat.com>
1 parent c9fc43a commit 5a36005

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/main.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ async fn main() -> Result<(), anyhow::Error> {
125125
.register_transaction(tx!(list_sboms))
126126
.register_transaction(tx!(list_sboms_paginated))
127127
.register_transaction(tx!(get_analysis_status))
128-
.register_transaction(tx!(get_analysis_latest_cpe));
128+
.register_transaction(tx!(get_analysis_latest_cpe))
129+
.register_transaction(tx!(search_licenses))
130+
.register_transaction(tx!(search_sboms_by_license))
131+
.register_transaction(tx!(search_purls_by_license));
129132

130133
tx!(s.get_sbom?(scenario.get_sbom.clone()));
131134
tx!(s.get_sbom_advisories?(scenario.get_sbom_advisories.clone()));

src/restapi.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,22 @@ pub async fn post_vulnerability_analyze(purl: String, user: &mut GooseUser) -> T
183183

184184
Ok(())
185185
}
186+
187+
pub async fn search_licenses(user: &mut GooseUser) -> TransactionResult {
188+
let _response = user.get("/api/v2/license?q=ASL&sort=license:desc").await?;
189+
Ok(())
190+
}
191+
192+
pub async fn search_sboms_by_license(user: &mut GooseUser) -> TransactionResult {
193+
let _response = user
194+
.get("/api/v2/sbom?q=license~GPL&sort=name:desc")
195+
.await?;
196+
Ok(())
197+
}
198+
199+
pub async fn search_purls_by_license(user: &mut GooseUser) -> TransactionResult {
200+
let _response = user
201+
.get("/api/v2/purl?q=license~GPLv3+ with exceptions|Apache&sort=name:desc")
202+
.await?;
203+
Ok(())
204+
}

0 commit comments

Comments
 (0)