Merge pull request 'Explain: don't prepare answers for date fields' (#101) from fix/explain-skip-date-fields into main
This commit was merged in pull request #101.
This commit is contained in:
@@ -798,6 +798,10 @@ mod tests {
|
|||||||
assert!(delivery_facts(&mut Facts::default(), &message, "[email protected]").is_err());
|
assert!(delivery_facts(&mut Facts::default(), &message, "[email protected]").is_err());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_timestamp(value: &str) -> bool {
|
||||||
|
chrono::DateTime::parse_from_rfc3339(value).is_ok()
|
||||||
|
}
|
||||||
|
|
||||||
/// The settings questions a release prepares answers for (EX-26): every
|
/// The settings questions a release prepares answers for (EX-26): every
|
||||||
/// non-secret property of every settings object, at the object's own
|
/// non-secret property of every settings object, at the object's own
|
||||||
/// default, built exactly as a live question is.
|
/// default, built exactly as a live question is.
|
||||||
@@ -842,6 +846,12 @@ mod tests {
|
|||||||
if info.secret {
|
if info.secret {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// A date's default is the moment the object is built, so its
|
||||||
|
// question changes every run and no live question ever
|
||||||
|
// matches it: nothing worth preparing.
|
||||||
|
if matches!(map[&property].as_str(), Some(v) if is_timestamp(v)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let mut facts = Facts::default();
|
let mut facts = Facts::default();
|
||||||
push_setting(&mut facts, &object, &property, &info, &map[&property]);
|
push_setting(&mut facts, &object, &property, &info, &map[&property]);
|
||||||
out.push((object.clone(), property, facts));
|
out.push((object.clone(), property, facts));
|
||||||
@@ -856,6 +866,7 @@ mod tests {
|
|||||||
assert!(questions.len() > 500, "found {}", questions.len());
|
assert!(questions.len() > 500, "found {}", questions.len());
|
||||||
assert!(questions.iter().any(|(o, p, _)| o == "x:Domain" && p == "dnsManagement"));
|
assert!(questions.iter().any(|(o, p, _)| o == "x:Domain" && p == "dnsManagement"));
|
||||||
assert!(!questions.iter().any(|(o, p, _)| o == "x:AiModel" && p == "httpAuth"));
|
assert!(!questions.iter().any(|(o, p, _)| o == "x:AiModel" && p == "httpAuth"));
|
||||||
|
assert!(!questions.iter().any(|(o, p, _)| o == "x:Account" && p == "createdAt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes `resources/explain/settings.json.gz` (EX-26). Run before a
|
/// Writes `resources/explain/settings.json.gz` (EX-26). Run before a
|
||||||
|
|||||||
Reference in New Issue
Block a user