I started my current project using native django templates and now I'm 
converting to jinja2.  For the most part, it has gone smoothly.  

The surprising roadblock was that this broke all my unit tests.   The issue is 
that django.template.backends.jinja2.Jinja2 doesn't populate response.context.

One thought I had was to patch django.shortcuts.render() with unittest.mock.  
That didn't work out so well.

Where I seem to be heading now is to have each of my View subclasses have a 
build_context() static method, put most of the logic in that, and then I can 
call that directly in my unit tests.  This seems to be workable, but it's kind 
of ugly that I need to alter my production code to make it testable.

Any wisdom from people who have gone through this would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/70A8C0DD-5C8D-4A30-89A5-A7F50A454DAB%40panix.com.

Reply via email to