summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-12-22 08:40:32 +0700
committerDaniil Baturin <daniil@baturin.org>2016-12-22 08:40:32 +0700
commitd99595ad09e0b8c96deb40db6cf79781f5992487 (patch)
tree834c5c1596e3a2186d7496f645c6c199d6b88d75 /test
parent53c65bd44ace64c39bb3019cf6884e929ebc6f4d (diff)
parentf2b20137711c8d6f2e468595d484b1e8ba3b1efd (diff)
downloadvyconf-d99595ad09e0b8c96deb40db6cf79781f5992487.tar.gz
vyconf-d99595ad09e0b8c96deb40db6cf79781f5992487.zip
Merge branch 'philsummers-master'
Diffstat (limited to 'test')
-rw-r--r--test/data/interface_definition_sample.xml12
-rw-r--r--test/reference_tree_test.ml23
2 files changed, 35 insertions, 0 deletions
diff --git a/test/data/interface_definition_sample.xml b/test/data/interface_definition_sample.xml
index f4b950e..6a4f201 100644
--- a/test/data/interface_definition_sample.xml
+++ b/test/data/interface_definition_sample.xml
@@ -20,6 +20,12 @@
</leafNode>
</children>
</tagNode>
+ <leafNode name="password">
+ <properties>
+ <help>A password</help>
+ <secret/>
+ </properties>
+ </leafNode>
</children>
</node>
<leafNode name="host-name">
@@ -43,6 +49,12 @@
<valueless/>
</properties>
</leafNode>
+ <leafNode name="enable-dangerous-features">
+ <properties>
+ <help>Enable dangerous features</help>
+ <hidden/>
+ </properties>
+ </leafNode>
</children>
</node>
</children>
diff --git a/test/reference_tree_test.ml b/test/reference_tree_test.ml
index 8ffc079..078fc00 100644
--- a/test/reference_tree_test.ml
+++ b/test/reference_tree_test.ml
@@ -71,6 +71,25 @@ let test_is_multi_invalid test_ctxt =
let r = load_from_xml r (in_testdata_dir test_ctxt ["interface_definition_sample.xml"]) in
assert_equal (is_multi r ["system"; "host-name"]) false
+let test_is_secret_valid test_ctxt =
+ let r = Vytree.make default_data "root" in
+ let r = load_from_xml r (in_testdata_dir test_ctxt ["interface_definition_sample.xml"]) in
+ assert_equal (is_secret r ["system"; "login"; "password"]) true
+
+let test_is_secret_invalid test_ctxt =
+ let r = Vytree.make default_data "root" in
+ let r = load_from_xml r (in_testdata_dir test_ctxt ["interface_definition_sample.xml"]) in
+ assert_equal (is_secret r ["system"; "login"; "user"; "full-name"]) false
+
+let test_is_hidden_valid test_ctxt =
+ let r = Vytree.make default_data "root" in
+ let r = load_from_xml r (in_testdata_dir test_ctxt ["interface_definition_sample.xml"]) in
+ assert_equal (is_hidden r ["system"; "options"; "enable-dangerous-features"]) true
+
+let test_is_hidden_invalid test_ctxt =
+ let r = Vytree.make default_data "root" in
+ let r = load_from_xml r (in_testdata_dir test_ctxt ["interface_definition_sample.xml"]) in
+ assert_equal (is_hidden r ["system"; "login"; "user"; "full-name"]) false
let suite =
"Util tests" >::: [
@@ -86,6 +105,10 @@ let suite =
"test_validate_path_valueless_node_valid" >:: test_validate_path_valueless_node_valid;
"test_is_multi_valid" >:: test_is_multi_valid;
"test_is_multi_invalid" >:: test_is_multi_invalid;
+ "test_is_secret_valid" >:: test_is_secret_valid;
+ "test_is_secret_invalid" >:: test_is_secret_invalid;
+ "test_is_hidden_valid" >:: test_is_hidden_valid;
+ "test_is_hidden_invalid" >:: test_is_hidden_invalid;
]
let () =