@ -120,7 +120,7 @@ class TestAnsibleModuleLogJournal:
assert journal_send . called == 1
assert journal_send . called == 1
# Message
# Message
# call_args is a 2-tuple of (arg_list, kwarg_dict)
# 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
# log adds this journal field
assert ' MODULE ' in journal_send . call_args [ 1 ]
assert ' MODULE ' in journal_send . call_args [ 1 ]
assert ' basic.py ' in journal_send . call_args [ 1 ] [ ' MODULE ' ]
assert ' basic.py ' in journal_send . call_args [ 1 ] [ ' MODULE ' ]
@ -133,14 +133,14 @@ class TestAnsibleModuleLogJournal:
journal_send = mocker . patch ( ' systemd.journal.send ' )
journal_send = mocker . patch ( ' systemd.journal.send ' )
am . log ( msg )
am . log ( msg )
assert journal_send . call_count == 1 , ' journal.send not called exactly once '
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 ' ] )
@pytest.mark.parametrize ( ' stdin ' , ( { } , ) , indirect = [ ' stdin ' ] )
def test_log_args ( self , am , mocker ) :
def test_log_args ( self , am , mocker ) :
journal_send = mocker . patch ( ' systemd.journal.send ' )
journal_send = mocker . patch ( ' systemd.journal.send ' )
am . log ( ' unittest log_args ' , log_args = dict ( TEST = ' log unittest ' ) )
am . log ( ' unittest log_args ' , log_args = dict ( TEST = ' log unittest ' ) )
assert journal_send . called == 1
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
# log adds this journal field
assert ' MODULE ' in journal_send . call_args [ 1 ]
assert ' MODULE ' in journal_send . call_args [ 1 ]