Example #1
0
class TestRequestWidgetHandlerView(TestCase):
    def setUp(self):
        self.handler = RequestWidgetHandler()
        self.handler.template = 'some template code'

    def test_default_resposne_template_not_found(self):
        mtpl = mock.Mock()
        mtpl.load = mock.Mock(side_effect=TemplateNotFound)
        with mock.patch('marimo.views.base.template_loader', mtpl):
            template_path = 'hello'
            response = self.handler.default_response(**{'template_path':template_path})
        self.assertEqual(response['template'], self.handler.template)

    def test_base_default_response_template(self):
        with mock.patch('marimo.views.base.template_loader') as mtpl:
            template_path = 'hello'
            self.handler.default_response(**{'template_path':template_path})

        mtpl.load.assert_called_with(template_path)

    def test_base_default_response_no_template(self):
        with mock.patch('marimo.views.base.template_loader') as mtpl:
            self.handler.default_response()

        self.assertTrue(not mtpl.called)
Example #2
0
 def setUp(self):
     self.handler = RequestWidgetHandler()
     self.handler.template = 'some template code'