Ejemplo n.º 1
0
    def test_get_template_names(self):
        req = RequestFactory().get(self.get_url() + '?path=/docs/')
        view = OnlineDocsView()
        view.dispatch(req)
        result = view.get_template_names()
        self.assertEqual(result, ['online_docs/online_docs.html'], msg=(
            'Should return the template of this app'))

        req.is_ajax = lambda: True
        view.dispatch(req)
        result = view.get_template_names()
        self.assertEqual(result, ['online_docs/partials/online_docs.html'],
            msg=('Should return the patial template if the request is an'
                 ' ajax call'))