Permalink
Browse files

Merge pull request #362 from NicolasLM/fix-log-test-3.7

Fix log test in Python 3.7
  • Loading branch information...
mjs committed Aug 30, 2018
2 parents aa9dfaf + 3d14999 commit 6a8912d80ffc7f2f63a2d81b3bda2f686c2d28bf
Showing with 16 additions and 6 deletions.
  1. +16 −6 tests/test_imapclient.py
View
@@ -505,13 +505,23 @@ def test_redacted_password(self):
adapter = IMAPlibLoggerAdapter(logger_mock, dict())
if six.PY3:
adapter.info("""> b'ICHH1 LOGIN foo@bar.org "secret"'""")
logger_mock._log.assert_called_once_with(
logging.INFO,
"> b'ICHH1 LOGIN **REDACTED**",
(),
extra={}
)
if sys.version_info >= (3, 7):
# LoggerAdapter in Python 3.7+ calls logger.log()
logger_mock.log.assert_called_once_with(
logging.INFO,
"> b'ICHH1 LOGIN **REDACTED**",
extra={}
)
else:
# LoggerAdapter in Python 3.4 to 3.6 calls logger._log()
logger_mock._log.assert_called_once_with(
logging.INFO,
"> b'ICHH1 LOGIN **REDACTED**",
(),
extra={}
)
else:
# LoggerAdapter in Python 2.7 calls logger.info()
adapter.info('> ICHH1 LOGIN foo@bar.org "secret"')
logger_mock.info.assert_called_once_with(
"> ICHH1 LOGIN **REDACTED**",

0 comments on commit 6a8912d

Please sign in to comment.