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: v17.2.1~48^2~43 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9f4163c88b91467289c54737b2625726605de315;p=ceph.git mgr/nfs: add test for access type validation func Signed-off-by: John Mulligan (cherry picked from commit bb2b45d7036cd6fe03c45f349c86302d7fbfbbf1) --- diff --git a/src/pybind/mgr/nfs/tests/test_nfs.py b/src/pybind/mgr/nfs/tests/test_nfs.py index 0a606dbdaaa..1fca67249e0 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")