def METHOD_NAME(self, m):
    messages = SanityCheckMessages()
    messages.info(None, "Some info")
    m.return_value = messages
    self.assertEqual(
        tasks.sanity_check(),
        "Sanity check exited with infos. See log.",
    )
    m.assert_called_once()