git-ents.gitmain
⌘K
foforge
redact.rs38 lines · 1.1 KB · rusthistorycomment on this file
1//! Integration coverage for `git ents redact` against a real local
2//! composition root (`roots.local`) — recording a redaction, then listing
3//! it back (`model.redaction`).
4
5#![allow(
6 clippy::expect_used,
7 clippy::indexing_slicing,
8 reason = "integration test"
9)]
10
11mod common;
12
13use git_ents::commands::redact;
14use git_ents::root::LocalRoot;
15
16/// `git ents redact list` surfaces every recorded redaction's id and
17/// reason — the only way to discover one before `git ents redact add`'s
18/// own record can be inspected again (`model.redaction`).
19// @relation(roots.local, model.redaction, scope=function, role=Verifies)
20#[test]
21fn list_returns_every_recorded_redaction() {
22 let fixture = common::Fixture::new(1);
23 let root = LocalRoot::open(fixture.path()).expect("opens");
24
25 let oid = "abababababababababababababababababababab";
26 redact::add(
27 &root,
28 oid,
29 "leaked credential".to_owned(),
30 Some(fixture.key_path.clone()),
31 )
32 .expect("adds");
33
34 let listed = redact::list(&root).expect("lists");
35 assert_eq!(listed.len(), 1);
36 assert_eq!(listed[0].0, oid);
37 assert_eq!(listed[0].1.reason, "leaked credential");
38}