From 5b4a7cc283422525001b3b9e1d86d8fb29d3aec4 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 25 Jul 2018 10:45:51 -0700 Subject: [PATCH] Fix journald unittests d7df072b9622b4795d50b994d499121bceab1054 changed how we call journal.send() from positional arguments to keyword arguments. So we need to update the test to check for the arguments it was called with in the keyword args, not in the positional args. --- test/units/module_utils/basic/test_log.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/units/module_utils/basic/test_log.py b/test/units/module_utils/basic/test_log.py index 6b5c258f6c..434f2b399b 100644 --- a/test/units/module_utils/basic/test_log.py +++ b/test/units/module_utils/basic/test_log.py @@ -120,7 +120,7 @@ class TestAnsibleModuleLogJournal: assert journal_send.called == 1 # Message # call_args is a 2-tuple of (arg_list, kwarg_dict) - assert journal_send.call_args[0][0].endswith('unittest no_log'), 'Message was not sent to log' + assert journal_send.call_args[1]['MESSAGE'].endswith('unittest no_log'), 'Message was not sent to log' # log adds this journal field assert 'MODULE' in journal_send.call_args[1] assert 'basic.py' in journal_send.call_args[1]['MODULE'] @@ -133,14 +133,14 @@ class TestAnsibleModuleLogJournal: journal_send = mocker.patch('systemd.journal.send') am.log(msg) assert journal_send.call_count == 1, 'journal.send not called exactly once' - assert journal_send.call_args[0][0].endswith(param) + assert journal_send.call_args[1]['MESSAGE'].endswith(param) @pytest.mark.parametrize('stdin', ({},), indirect=['stdin']) def test_log_args(self, am, mocker): journal_send = mocker.patch('systemd.journal.send') am.log('unittest log_args', log_args=dict(TEST='log unittest')) assert journal_send.called == 1 - assert journal_send.call_args[0][0].endswith('unittest log_args'), 'Message was not sent to log' + assert journal_send.call_args[1]['MESSAGE'].endswith('unittest log_args'), 'Message was not sent to log' # log adds this journal field assert 'MODULE' in journal_send.call_args[1]