summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2018-02-09 23:09:41 +1300
committerAndrew Bartlett <abartlet@samba.org>2018-02-12 05:21:01 +0100
commitcb920dd8732af30a7f74d5b492ea6ddfc2adfcbd (patch)
treed3525386331459a7a4d5c9ce919570068cb76e82 /python
parent72a81529aa13ac34a6dc1b1cdc37d1329af48ffe (diff)
downloadsamba-cb920dd8732af30a7f74d5b492ea6ddfc2adfcbd.tar.gz
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@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Mon Feb 12 05:21:01 CET 2018 on sn-devel-144
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/samba_tool/user_wdigest.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/python/samba/tests/samba_tool/user_wdigest.py b/python/samba/tests/samba_tool/user_wdigest.py
index 497855c7b73..35283ebfcb3 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"