'Asserts that the logger was not called with a warning.'

@contextmanager
def assert_no_warning_logged(self):

    with patch('openedx.core.djangoapps.safe_sessions.middleware.log.warning') as mock_log:
        (yield)
        self.assertFalse(mock_log.called)
