]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/smb: add test coverage for all utils.py functions
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 8 May 2024 14:49:20 +0000 (10:49 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 24 Jun 2024 12:41:08 +0000 (08:41 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/tests/test_utils.py

index 5017990e9b17297cccc948194c8b6be89fa78b84..99f9ce53faa96ceefba0a5f4f9eb7671da330a89 100644 (file)
@@ -26,3 +26,18 @@ def test_rand_name():
     assert len(name) == 18
     name = smb.utils.rand_name('')
     assert len(name) == 8
+
+
+def test_checked():
+    assert smb.utils.checked('foo') == 'foo'
+    assert smb.utils.checked(77) == 77
+    assert smb.utils.checked(0) == 0
+    with pytest.raises(smb.utils.IsNoneError):
+        smb.utils.checked(None)
+
+
+def test_ynbool():
+    assert smb.utils.ynbool(True) == 'Yes'
+    assert smb.utils.ynbool(False) == 'No'
+    # for giggles
+    assert smb.utils.ynbool(0) == 'No'