From: Douglas Bagnall Date: Thu, 18 Apr 2019 01:37:27 +0000 (+1200) Subject: pytests: slightly better errors in Testcase.insta_creds() X-Git-Tag: tdb-1.4.1~230 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a047e71bc7daea3855fc786c0e1c9d09878bba5f;p=thirdparty%2Fsamba.git pytests: slightly better errors in Testcase.insta_creds() Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index f904499b90b..cbd164de1f9 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -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