Skip to content

Commit

Permalink
test: fix paths after relocation
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Mar 20, 2024
1 parent 280c487 commit 969b8fa
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
5 changes: 2 additions & 3 deletions modules/ingestor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ edition = "2021"
publish = false

[dependencies]
trustify-common = { path = "../../common"}
trustify-common = { path = "../../common" }
trustify-cvss = { path = "../../cvss" }
trustify-entity = { path = "../../entity" }
trustify-module-graph = { path = "../graph"}
trustify-module-graph = { path = "../graph" }

actix-web = "4"
anyhow = "1.0.72"
Expand All @@ -27,7 +27,6 @@ sha2 = "0.10.8"
thiserror = "1.0.58"
tokio = { version = "1.30.0", features = ["full"] }
utoipa = "4"
walker-common = "=0.6.0-alpha.8"

[dev-dependencies]
test-log = { version = "0.2.15", features = ["env_logger", "trace"] }
Expand Down
5 changes: 2 additions & 3 deletions modules/ingestor/src/endpoints/advisory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use csaf::Csaf;
use sha2::{Digest, Sha256};
use trustify_module_graph::endpoints::Error;
use trustify_module_graph::graph::Graph;
use walker_common::utils::hex::Hex;

#[utoipa::path(responses((status = 200, description = "Upload a file")))]
#[post("/advisories")]
Expand All @@ -16,7 +15,7 @@ pub async fn upload_advisory(
) -> Result<impl Responder, Error> {
// TODO: investigate how to parse files from a stream
let payload_bytes = payload.to_bytes().await?;
let sha256 = Hex(&Sha256::digest(&payload_bytes)).to_lower();
let sha256 = hex::encode(&Sha256::digest(&payload_bytes));

let csaf = serde_json::from_slice::<Csaf>(&payload_bytes).map_err(|_e| Error::BadRequest {
msg: "File could not be parsed".to_string(),
Expand Down Expand Up @@ -54,7 +53,7 @@ mod tests {
.await;

let pwd = PathBuf::from_str(env!("CARGO_MANIFEST_DIR"))?;
let test_data = pwd.join("../etc/test-data");
let test_data = pwd.join("../../etc/test-data");

let advisory = test_data.join("cve-2023-33201.json");

Expand Down
2 changes: 1 addition & 1 deletion modules/ingestor/src/service/advisory/osv/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ mod test {
let graph = Graph::new(db);

let pwd = PathBuf::from_str(env!("CARGO_MANIFEST_DIR"))?;
let test_data = pwd.join("../etc/test-data/osv");
let test_data = pwd.join("../../etc/test-data/osv");

let osv_json = test_data.join("RUSTSEC-2021-0079.json");
let osv_file = File::open(osv_json)?;
Expand Down
2 changes: 1 addition & 1 deletion modules/ingestor/src/service/cve/cve_record/v5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ mod test {
#[test(tokio::test)]
async fn serde() -> Result<(), anyhow::Error> {
let pwd = PathBuf::from_str(env!("CARGO_MANIFEST_DIR"))?;
let test_data = pwd.join("../etc/test-data/mitre");
let test_data = pwd.join("../../etc/test-data/mitre");

let cve_json = test_data.join("CVE-2024-28111.json");

Expand Down
2 changes: 1 addition & 1 deletion modules/ingestor/src/service/cve/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ mod test {
let graph = Graph::new(db);

let pwd = PathBuf::from_str(env!("CARGO_MANIFEST_DIR"))?;
let test_data = pwd.join("../etc/test-data/mitre");
let test_data = pwd.join("../../etc/test-data/mitre");

let cve_json = test_data.join("CVE-2024-28111.json");
let cve_file = File::open(cve_json)?;
Expand Down

0 comments on commit 969b8fa

Please sign in to comment.