def test_get_context_data(self): """ Test :py:meth:`.TemplateView.get_context_data`. """ view = TemplateView() self.assertEqual({'params': { 'foo': 'bar', }}, view.get_context_data(foo='bar'))
def test_get_context_data(self): """ Test :py:meth:`.TemplateView.get_context_data`. """ view = TemplateView() self.assertEqual({ 'params': { 'foo': 'bar', } }, view.get_context_data(foo='bar'))
def test_get(self): """ Test :py:meth:`.TemplateView.get`. """ view = TemplateView() view.get_context_data = Mock(return_value={'foo': 'bar'}) view.render_to_response = Mock(return_value='response') self.assertEqual('response', view.get(bar='foo')) view.get_context_data.assert_called_once_with(bar='foo') view.render_to_response.assert_called_once_with({'foo': 'bar'})