-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from kpcyrd/lfs
Add tests and test data
- Loading branch information
Showing
17 changed files
with
150 additions
and
39 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
tests/data/**/*.xz filter=lfs diff=lfs merge=lfs -text | ||
tests/data/**/*.gz filter=lfs diff=lfs merge=lfs -text | ||
tests/data/** filter=lfs diff=lfs merge=lfs -text |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//! WARNING: This API may not be stable | ||
//! | ||
//! If that's fine with you, you may still use this code according to `GPL-3.0-or-later`. 🖤 | ||
pub mod apt; | ||
pub mod args; | ||
pub mod buildinfo; | ||
pub mod chksums; | ||
pub mod compression; | ||
pub mod errors; | ||
pub mod pgp; | ||
pub mod pkgbuild; | ||
pub mod plumbing; |
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
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
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
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use backseat_signed::apt; | ||
use backseat_signed::chksums; | ||
use backseat_signed::pgp; | ||
use std::io::Read; | ||
|
||
#[test] | ||
fn parse_lookup_apt_release_xz() { | ||
let release = include_bytes!("data/vim/Release"); | ||
let release = apt::Release::parse(release).unwrap(); | ||
|
||
let sources = include_bytes!("data/vim/Sources.xz"); | ||
let sha256 = chksums::sha256(sources); | ||
|
||
let _sources_entry = release.find_source_entry_by_sha256(&sha256).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn parse_lookup_apt_release_gz() { | ||
let release = include_bytes!("data/vim/Release"); | ||
let release = apt::Release::parse(release).unwrap(); | ||
|
||
let sources = include_bytes!("data/vim/Sources.gz"); | ||
let sha256 = chksums::sha256(sources); | ||
|
||
let _sources_entry = release.find_source_entry_by_sha256(&sha256).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn parse_lookup_apt_release_plain() { | ||
let release = include_bytes!("data/vim/Release"); | ||
let release = apt::Release::parse(release).unwrap(); | ||
|
||
let sources = include_bytes!("data/vim/Sources.lz4"); | ||
let mut lz4 = lz4_flex::frame::FrameDecoder::new(&sources[..]); | ||
|
||
let mut sources = Vec::new(); | ||
lz4.read_to_end(&mut sources).unwrap(); | ||
let sha256 = chksums::sha256(&sources); | ||
|
||
let _sources_entry = release.find_source_entry_by_sha256(&sha256).unwrap(); | ||
} | ||
|
||
#[test] | ||
fn test_pgp_verify_vim() { | ||
let keyring = include_bytes!("data/debian-archive-bookworm-automatic.asc"); | ||
let keyring = pgp::keyring(keyring).unwrap(); | ||
|
||
let sig = include_bytes!("data/vim/Release.gpg"); | ||
let sig = pgp::signature(sig).unwrap(); | ||
|
||
let release = include_bytes!("data/vim/Release"); | ||
pgp::verify(&keyring, &sig, release).unwrap(); | ||
} |