def test_getCache_redirected_view(self): # A redirection view may be provided with a target view instance from # which json cache data is obtained. class TestView(LaunchpadView): pass request = LaunchpadTestRequest() test_view = TestView(self.getCanada(), request) view = RedirectionView(None, request, cache_view=test_view) IJSONRequestCache(request).objects['my_bool'] = True json_dict = simplejson.loads(view.getCacheJSON()) self.assertIsCanada(json_dict['context']) self.assertIn('my_bool', json_dict)
def test_getCache_redirected_view_default(self): # A redirection view by default provides no json cache data. request = LaunchpadTestRequest() view = RedirectionView(None, request) json_dict = simplejson.loads(view.getCacheJSON()) self.assertEqual({}, json_dict)