From 54cd6751133b4056a130ac01bd136aee5af4f33e Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 17 Mar 2025 16:11:56 -0400 Subject: [PATCH] mgr/smb: add tests cases for smb show password filter Signed-off-by: John Mulligan --- src/pybind/mgr/smb/tests/test_smb.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/pybind/mgr/smb/tests/test_smb.py b/src/pybind/mgr/smb/tests/test_smb.py index 0d3610326c2..f94939ffaa3 100644 --- a/src/pybind/mgr/smb/tests/test_smb.py +++ b/src/pybind/mgr/smb/tests/test_smb.py @@ -722,3 +722,29 @@ def test_show_cluster_without_shares(tmodule): } """.strip() ) + + +def test_show_password_filter_hidden(tmodule): + _example_cfg_1(tmodule) + out = tmodule.show(password_filter=smb.enums.PasswordFilter.HIDDEN) + assert 'resources' in out + res = out['resources'] + assert len(res) == 4 + ja = [r for r in res if r['resource_type'] == 'ceph.smb.join.auth'] + assert ja + join_auth = ja[0] + assert join_auth['auth']['username'] == 'testadmin' + assert join_auth['auth']['password'] == '****************' + + +def test_show_password_filter_b64(tmodule): + _example_cfg_1(tmodule) + out = tmodule.show(password_filter=smb.enums.PasswordFilter.BASE64) + assert 'resources' in out + res = out['resources'] + assert len(res) == 4 + ja = [r for r in res if r['resource_type'] == 'ceph.smb.join.auth'] + assert ja + join_auth = ja[0] + assert join_auth['auth']['username'] == 'testadmin' + assert join_auth['auth']['password'] == 'UGFzc3cwcmQ=' -- 2.39.5