diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/data/interface_definition_sample.xml | 12 | ||||
-rw-r--r-- | test/reference_tree_test.ml | 23 |
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 () = |