|
|
|
@ -294,12 +294,20 @@ class TestModuleUtilsBasicHelpers(unittest.TestCase):
|
|
|
|
|
ssh_output = self.module._heuristic_log_sanitize(ssh_data)
|
|
|
|
|
|
|
|
|
|
# Basic functionality: Successfully hid the password
|
|
|
|
|
try:
|
|
|
|
|
self.assertNotIn('pas:word', url_output)
|
|
|
|
|
self.assertNotIn('pas:word', ssh_output)
|
|
|
|
|
|
|
|
|
|
# Slightly more advanced, we hid all of the password despite the ":"
|
|
|
|
|
self.assertNotIn('pas', url_output)
|
|
|
|
|
self.assertNotIn('pas', ssh_output)
|
|
|
|
|
except AttributeError:
|
|
|
|
|
# python2.6 or less's unittest
|
|
|
|
|
self.assertFalse('pas:word' in url_output, '%s is present in %s' % ('"pas:word"', url_output))
|
|
|
|
|
self.assertFalse('pas:word' in ssh_output, '%s is present in %s' % ('"pas:word"', ssh_output))
|
|
|
|
|
|
|
|
|
|
self.assertFalse('pas' in url_output, '%s is present in %s' % ('"pas"', url_output))
|
|
|
|
|
self.assertFalse('pas' in ssh_output, '%s is present in %s' % ('"pas"', ssh_output))
|
|
|
|
|
|
|
|
|
|
# In this implementation we replace the password with 8 "*" which is
|
|
|
|
|
# also the length of our password. The url fields should be able to
|
|
|
|
@ -313,7 +321,11 @@ class TestModuleUtilsBasicHelpers(unittest.TestCase):
|
|
|
|
|
# the data, though:
|
|
|
|
|
self.assertTrue(ssh_output.startswith("{'"))
|
|
|
|
|
self.assertTrue(ssh_output.endswith("'}}}}"))
|
|
|
|
|
try:
|
|
|
|
|
self.assertIn(":********@foo.com/data',", ssh_output)
|
|
|
|
|
except AttributeError:
|
|
|
|
|
# python2.6 or less's unittest
|
|
|
|
|
self.assertTrue(":********@foo.com/data'," in ssh_output, '%s is not present in %s' % (":********@foo.com/data',", ssh_output))
|
|
|
|
|
|
|
|
|
|
# The overzealous-ness here may lead to us changing the algorithm in
|
|
|
|
|
# the future. We could make it consume less of the data (with the
|
|
|
|
|