'Test that the RequestContext is cached in the RequestCache.'

def test_request_context_caching(self):

    with patch('edxmako.request_context.get_current_request', return_value=None):
        self.assertIsNone(get_template_request_context())
    with patch('edxmako.request_context.get_current_request', return_value=self.request):
        self.assertIsNotNone(get_template_request_context())
    mock_get_current_request = Mock()
    with patch('edxmako.request_context.get_current_request', mock_get_current_request):
        self.assertIsNotNone(get_template_request_context())
    mock_get_current_request.assert_not_called()
    RequestCache.clear_request_cache()
    with patch('edxmako.request_context.get_current_request', return_value=None):
        self.assertIsNone(get_template_request_context())
