I'm internationalizing/i18n-ing a django project. We have one part that runs independently and performs background tasks. It's called by rabbitmq. I want to test that the i18n/l10n works for that part. However our app isn't translated yet, and won't be for a while. I want to write the unittests before translation begins.
I'd like to mock some translations, so that _("anything")
is returned as a constant string, so that I can test that it's trying to translate things, without me needing to set up all the translations.
I tried using mock, but with mock.patch('django.utils.translations.ugettext_lazy'), my_function_that_just_returns_one_string):
didn't work. The _
is imported as from django.utils.translations import ugettext_lazy as _
.