mod audit;
mod corpus;
mod headers;
mod name_rule;
mod paths;
mod schemas;
mod texts;
use super::names::{CREDENTIAL_MEMBERS, is_credential_name, normalised};
use super::*;
use crate::gateway::withhold_rules;
use crate::gateway::withhold_rules::check;
use crate::gateway::withhold_rules::corpus::PINNED_DOCUMENTS;
use crate::gateway::withhold_rules::values::{is_date, looks_like_password, url_withheld};
use crate::json::{parse, to_compact};
fn checked(text: &str) -> bool {
check::withheld(&parse(text).unwrap())
}
fn secrets_of(policy: &Policy) -> SecretSet {
applied(
r#"{"credentials":{"password":"FAKE-GW-SECRET-15","username":"edge"}}"#,
policy,
)
.1
}
fn applied(text: &str, policy: &Policy) -> (String, SecretSet) {
let secrets = SecretSet::default();
let mut doc = parse(text).unwrap();
apply(&mut doc, policy, &secrets);
(to_compact(&doc).unwrap(), secrets)
}
fn printed_formats(doc: &OValue) -> [(crate::output::Format, String); 3] {
use crate::output::Format;
use crate::output::testing::capture;
[Format::Json, Format::Pretty, Format::Table].map(|format| {
let (mut out, stdout, _) = capture(false);
crate::gateway::views::render_detail(&mut out, doc, format).unwrap();
out.commit().unwrap();
(format, stdout.text())
})
}