'Logging translation errors is really important, so test it.'

@mock_gettext
@patch('kitsune.sumo.email_utils.log')
def test_safe_translation_logging(self, mocked_log):

    from django.utils.translation import ugettext as _
    @safe_translation
    def bad_trans(locale):
        return _('Hello    {name}').format(name='Mike')
    bad_trans('en-US')
    bad_trans('es')
    eq_(len(mocked_log.method_calls), 0)
    bad_trans('fr')
    eq_(len(mocked_log.method_calls), 1)
    (method_name, method_args, method_kwargs) = mocked_log.method_calls[0]
    eq_(method_name, 'exception')
    assert ('Bad    translation' in method_args[0])
    eq_(method_args[1], 'fr')
