diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2021-10-24 15:18:05 +1300 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2021-11-08 10:46:44 +0100 |
commit | db401161cf94e30d44d6981ea9c17aaabd028562 (patch) | |
tree | 9b561b4f36469807bf3b43992ac7292dd9dd312d /python | |
parent | 25790f26c6f25306d880fdad089268395a1e5f72 (diff) | |
download | samba-db401161cf94e30d44d6981ea9c17aaabd028562.tar.gz |
CVE-2020-25722 pytest: assertRaisesLdbError invents a message if you're lazy
This makes it easier to convert tests that don't have good messages.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14564
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/tests/__init__.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index a6d15f54548..2c4c8fad83e 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -209,6 +209,8 @@ class TestCase(unittest.TestCase): def assertRaisesLdbError(self, errcode, message, f, *args, **kwargs): """Assert a function raises a particular LdbError.""" + if message is None: + message = f"{f.__name__}(*{args}, **{kwargs})" try: f(*args, **kwargs) except ldb.LdbError as e: |