mirror of
https://github.com/OMGeeky/advisory-db.git
synced 2026-01-03 10:05:26 +01:00
Update to 'rustsec' crate v0.7.0-alpha3
Testing the alpha crate on the live repository prior to a final release
This commit is contained in:
@@ -3,11 +3,11 @@ name = "rustsec-advisory-db"
|
||||
description = "Security advisory database for Rust crates published through crates.io"
|
||||
version = "0.0.0"
|
||||
authors = ["Tony Arcieri <bascule@gmail.com>"]
|
||||
license_file = "LICENSE.txt"
|
||||
license-file = "LICENSE.txt"
|
||||
repository = "https://github.com/rustsec/advisory-db"
|
||||
documentation = "https://github.com/rustsec/advisory-db"
|
||||
categories = ["api-bindings", "development-tools"]
|
||||
keywords = ["rustsec", "security", "advisory", "vulnerability"]
|
||||
|
||||
[dependencies]
|
||||
rustsec = "^0.5.2"
|
||||
rustsec = "0.7.0-alpha3"
|
||||
|
||||
23
src/lib.rs
23
src/lib.rs
@@ -2,24 +2,19 @@ extern crate rustsec;
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
// Name of the advisory database in the current repo
|
||||
const ADVISORY_DB_FILE: &'static str = "Advisories.toml";
|
||||
|
||||
use rustsec::AdvisoryDatabase;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use rustsec::{AdvisoryDatabase, Repository};
|
||||
|
||||
#[test]
|
||||
fn advisories_toml_is_well_formed() {
|
||||
let path = Path::new(ADVISORY_DB_FILE);
|
||||
|
||||
let mut file = File::open(&path).unwrap();
|
||||
|
||||
let mut toml = String::new();
|
||||
file.read_to_string(&mut toml).unwrap();
|
||||
let repo = Repository::open(".").unwrap();
|
||||
|
||||
// Ensure Advisories.toml parses
|
||||
AdvisoryDatabase::from_toml(&toml).unwrap();
|
||||
let advisory_count = AdvisoryDatabase::from_repository(&repo)
|
||||
.unwrap()
|
||||
.advisories()
|
||||
.count();
|
||||
|
||||
// Ensure we're parsing some advisories
|
||||
assert!(advisory_count > 5);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user