python/samba/tests: fix SamDB dummy replacement
authorJoe Guo <joeg@catalyst.net.nz>
Mon, 30 Jul 2018 01:56:55 +0000 (13:56 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 17 Aug 2018 00:58:26 +0000 (02:58 +0200)
In commit 6de9d878b, a dummy SamDB lambda was added:

    SamDB = lambda *x: None

The `*x` will only cover positional args. If we call it with kwargs:

    samdb = SamDB(url=url)

We will get TypeError:

    <lambda>() got an unexpected keyword argument 'url'

This commit fix this. It also fix PEP8 E731:

    do not assign a lambda expression, use a def

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13542

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/__init__.py

index dcee691e6e91f90441cdd39f8d4f0b2e55af68f9..97ce8d1c495be8dad53bd2e9cc2a99a5154f05ec 100644 (file)
@@ -43,7 +43,9 @@ try:
 except ImportError:
     # We are built without samdb support,
     # imitate it so that connect_samdb() can recover
-    SamDB = lambda *x: None
+    def SamDB(*args, **kwargs):
+        return None
+
 import samba.ndr
 import samba.dcerpc.dcerpc
 import samba.dcerpc.epmapper