Permalink
Browse files

Fix log test in Python 3.7

Addresses changes made by CPython commit ce9e62544571e7ad.
  • Loading branch information...
NicolasLM committed Aug 30, 2018
1 parent aa9dfaf commit 3d1499931445201a21f552e616f36569f4c466b4
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 3d14999

Please sign in to comment.