'Asserts that the logger with the given log_level was called
with a string.'

@contextmanager
def assert_logged_with_message(self, log_string, log_level='error'):

    with patch(('openedx.core.djangoapps.safe_sessions.middleware.log.' + log_level)) as mock_log:
        (yield)
        mock_log.assert_any_call(log_string)
