From: John Mulligan Date: Thu, 21 Apr 2022 19:34:25 +0000 (-0400) Subject: mgr/nfs: add test for access type validation func X-Git-Tag: v18.0.0~948^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bb2b45d7036cd6fe03c45f349c86302d7fbfbbf1;p=ceph.git mgr/nfs: add test for access type validation func Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/nfs/tests/test_nfs.py b/src/pybind/mgr/nfs/tests/test_nfs.py index 0a606dbdaaa3..1fca67249e0d 100644 --- a/src/pybind/mgr/nfs/tests/test_nfs.py +++ b/src/pybind/mgr/nfs/tests/test_nfs.py @@ -1044,3 +1044,14 @@ def test_ganesha_validate_squash(): _validate_squash("root") with pytest.raises(NFSInvalidOperation): _validate_squash("toot") + + +def test_ganesha_validate_access_type(): + """Check error handling of internal validation function for access type value.""" + from nfs.ganesha_conf import _validate_access_type + from nfs.exception import NFSInvalidOperation + + for ok in ("rw", "ro", "none"): + _validate_access_type(ok) + with pytest.raises(NFSInvalidOperation): + _validate_access_type("any")