title: Testing django internationalization - Mocking gettext
body: <p>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.</p>
  
  <p>I'd like to mock some translations, so that <code>_("anything")</code> 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.</p>
  
  <p>I tried using <a href="http://www.voidspace.org.uk/python/mock/" rel="noreferrer">mock</a>, but <code>with mock.patch('django.utils.translations.ugettext_lazy'), my_function_that_just_returns_one_string):</code> didn't work. The <code>_</code> is imported as <code>from django.utils.translations import ugettext_lazy as _</code>.</p>