Hello,
I wrote a context processor which makes some global variables of mine available for templates. I cannot find a good (cough… any) article on how to test such processors. Could you give me some directions on where to start with writing one?
Thanks in advance!
Best,
Gergely
Hello,
My processor sets some template variables based on request.user and some DB/redis query results, which are displayed on each page on a header bar, so I only need to create a mocked request with user set to something (AnonymousUser or a valid user object).
I'm already using Mock[2] for middleware testing, funny that I didn't think of this way (especially as I implemented it today), so thanks for pointing out!
[2] https://pypi.python.org/pypi/mock
--
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...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/55085D7A.5040007%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.