'Asserts that the logger was called with the given message.'

def _assert_message_presence_in_logs(self, message, mock_log, expected_presence=True):

    message_present = any([(message in call_args[0][0]) for call_args in mock_log.warning.call_args_list])
    if expected_presence:
        self.assertTrue(message_present)
    else:
        self.assertFalse(message_present)
