'Context manager for mocking function calls.'

def mock_preparation(self, is_admin=False):

    return contextlib.nested(patch.object(c, 'user', self.user, create=True), patch.object(c, 'user_is_admin', is_admin, create=True), patch.object(MessageBuilder, '_viewable_message', return_value=True))
