aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datastructures.rs10
-rw-r--r--src/test.rs6
2 files changed, 12 insertions, 4 deletions
diff --git a/src/datastructures.rs b/src/datastructures.rs
index ba73d96..e004514 100644
--- a/src/datastructures.rs
+++ b/src/datastructures.rs
@@ -230,6 +230,11 @@ impl Config {
pub(crate) fn get_white_list_mode_status(&self) -> bool {
self.protect_config.get_white_list_mode_status()
}
+
+ #[cfg(test)]
+ pub(crate) fn query_is_all_protected(&self) -> bool {
+ self.protect_config.query_is_all_protected()
+ }
}
impl TestSuite for Config {
@@ -379,6 +384,11 @@ impl ProtectSettings {
pub(crate) fn get_white_list_mode_status(&self) -> bool {
self.protect_white_list_mode
}
+
+ #[cfg(test)]
+ pub(crate) fn query_is_all_protected(&self) -> bool {
+ self.protect_enabled && self.protect_white_list_mode && self.repos.is_empty()
+ }
}
impl TestSuite for ProtectSettings {
diff --git a/src/test.rs b/src/test.rs
index 68ba29d..8ae631a 100644
--- a/src/test.rs
+++ b/src/test.rs
@@ -323,8 +323,7 @@ mod core {
assert!(cfg.check_repo_protect("test"), "struct: {:#?}", cfg);
assert!(!cfg.get_white_list_mode_status());
- // TODO:
- //assert!(!cfg.query_is_all_protected());
+ assert!(!cfg.query_is_all_protected());
write_to_specify_file(
&tmpdir.path().join("REPO_SETTING"),
@@ -336,8 +335,7 @@ mod core {
assert!(!cfg.check_repo_protect("test"));
assert!(!cfg.get_white_list_mode_status());
- // TODO:
- //assert!(!cfg.query_is_all_protected());
+ assert!(!cfg.query_is_all_protected());
tmpdir.close().unwrap();
}