pytests: slightly better errors in Testcase.insta_creds()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 18 Apr 2019 01:37:27 +0000 (13:37 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 1 May 2019 05:32:25 +0000 (05:32 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/__init__.py

index f904499b90b7c7c7ccc4f9d88bd29e099fd00df4..cbd164de1f9d19bd637e5fcf6ba327e9cbf18b9c 100644 (file)
@@ -113,10 +113,11 @@ class TestCase(unittest.TestCase):
     def insta_creds(self, template=None, username=None, userpass=None, kerberos_state=None):
 
         if template is None:
-            assert template is not None
+            raise ValueError("you need to supply a Credentials template")
 
-        if username is not None:
-            assert userpass is not None
+        if username is not None and userpass is None:
+            raise ValueError(
+                "you cannot set creds username without setting a password")
 
         if username is None:
             assert userpass is None