[SCM] Samba Shared Repository - branch master updated
Andrew Bartlett
abartlet at samba.org
Mon Feb 12 04:22:02 UTC 2018
The branch, master has been updated
via cb920dd tests/samba-tool user wdigest: fix a flapping test
via 72a8152 tests: SambaToolCmdTest.assertMatch() indicates what was asserted
from 597e755 winbindd: WBFLAG_PAM_AUTH_PAC should call add_trusted_domain_from_auth() is the result is trusted
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cb920dd8732af30a7f74d5b492ea6ddfc2adfcbd
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Fri Feb 9 23:09:41 2018 +1300
tests/samba-tool user wdigest: fix a flapping test
The output of something like
samba-tool user getpassword $USER --attributes virtualWDigest01
contains an LDIF section with long strings folded on the 77th column.
To unfold this LDIF we were using:
result = re.sub(r"\n\s*", '', out)
which worked fine EXCEPT when a space in the output happened to land
immediately after the fold and got eaten by the \s*.
Instead we remove just a single space after the line break, because
that is always what fold_string() in lib/ldb/common/ldb_ldif.c
inserts, and for this simple replacement we don't need the re module.
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
Autobuild-Date(master): Mon Feb 12 05:21:01 CET 2018 on sn-devel-144
commit 72a81529aa13ac34a6dc1b1cdc37d1329af48ffe
Author: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Date: Fri Feb 9 14:29:43 2018 +1300
tests: SambaToolCmdTest.assertMatch() indicates what was asserted
Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet at samba.org>
-----------------------------------------------------------------------
Summary of changes:
python/samba/tests/samba_tool/base.py | 12 +++++++++++-
python/samba/tests/samba_tool/user_wdigest.py | 5 ++---
2 files changed, 13 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py
index c57e9e9..de257e3 100644
--- a/python/samba/tests/samba_tool/base.py
+++ b/python/samba/tests/samba_tool/base.py
@@ -29,6 +29,13 @@ from cStringIO import StringIO
from samba.netcmd.main import cmd_sambatool
import samba.tests
+
+def truncate_string(s, cutoff=100):
+ if len(s) < cutoff + 15:
+ return s
+ return s[:cutoff] + '[%d more characters]' % (len(s) - cutoff)
+
+
class SambaToolCmdTest(samba.tests.BlackboxTestCase):
def getSamDB(self, *argv):
@@ -88,7 +95,10 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase):
def assertCmdFail(self, val, msg=""):
self.assertIsNotNone(val, msg)
- def assertMatch(self, base, string, msg=""):
+ def assertMatch(self, base, string, msg=None):
+ if msg is None:
+ msg = "%r is not in %r" % (truncate_string(string),
+ truncate_string(base))
self.assertTrue(string in base, msg)
def randomName(self, count=8):
diff --git a/python/samba/tests/samba_tool/user_wdigest.py b/python/samba/tests/samba_tool/user_wdigest.py
index 497855c..35283eb 100644
--- a/python/samba/tests/samba_tool/user_wdigest.py
+++ b/python/samba/tests/samba_tool/user_wdigest.py
@@ -31,7 +31,6 @@ from samba import (
from samba.ndr import ndr_unpack
from samba.dcerpc import drsblobs
from hashlib import md5
-import re
import random
import string
@@ -105,8 +104,8 @@ class UserCmdWdigestTestCase(SambaToolCmdTest):
if missing:
self.assertTrue(attribute not in out)
else:
- result = re.sub(r"\n\s*", '', out)
- self.assertMatch(result, "%s: %s" % (attribute, expected))
+ self.assertMatch(out.replace('\n ', ''),
+ "%s: %s" % (attribute, expected))
def test_Wdigest_no_suffix(self):
attribute = "virtualWDigest"
--
Samba Shared Repository
More information about the samba-cvs
mailing list