Skip to content
This repository
Browse code

Remove jingo.views and tests. Fix #2.

With the changes since #2 was filed, it's no longer necessary to have
jingo.views.direct_to_template at all. Django's direct_to_template view
works just fine with jingo.Loader.

I cleaned up some tests, but jingo.render_to_string is still a different
function than django.template.loader.render_to_string, so I wasn't able
to drop that.
  • Loading branch information...
commit 52b1f57ad22dbce08748ba8460e9d7d57e573f13 1 parent 6f1de5e
authored
15  jingo/tests/test_views.py
... ...
@@ -1,17 +1,18 @@
1 1
 from django.utils import translation
2  
-from mock import Mock, patch, sentinel
  2
+from django.views.generic.simple import direct_to_template
3 3
 
  4
+from mock import patch, sentinel
4 5
 from nose.tools import eq_
5 6
 
6  
-import jingo.views
7  
-from jingo import get_env
  7
+from jingo import get_env, render_to_string
8 8
 
9 9
 
10 10
 @patch('jingo.render')
11 11
 def test_direct_to_template(mock_render):
12  
-    request = sentinel.request
13  
-    jingo.views.direct_to_template(request, 'base.html', x=1)
14  
-    mock_render.assert_called_with(request, 'base.html', {'x': 1})
  12
+    response = direct_to_template(sentinel.request,
  13
+                                  'jinja_app/test_nonoverride.html',
  14
+                                  {'x': 1})
  15
+    eq_('HELLO', response.content)
15 16
 
16 17
 
17 18
 def test_template_substitution_crash():
@@ -22,5 +23,5 @@ def test_template_substitution_crash():
22 23
     # The localized string has the wrong variable name in it
23 24
     s = '{% trans string="heart" %}Broken {{ string }}{% endtrans %}'
24 25
     template = env.from_string(s)
25  
-    rendered = jingo.render_to_string(Mock(), template, {})
  26
+    rendered = render_to_string(sentinel.request, template, {})
26 27
     eq_(rendered, 'Broken heart')
5  jingo/views.py
... ...
@@ -1,5 +0,0 @@
1  
-import jingo
2  
-
3  
-
4  
-def direct_to_template(request, template, **kwargs):
5  
-    return jingo.render(request, template, kwargs)

0 notes on commit 52b1f57

Please sign in to comment.
Something went wrong with that request. Please try again.