Example #1
0
def test_activate_with_override_settings_and_django_14():
    # Django 1.4 includes a handy override_settings helper. When you
    # use that, it must not include SETTINGS_MODULE in the settings.
    # This tests that activating a locale doesn't throw an
    # AssertionError because there's no SETTINGS_MODULE in settings.
    if django.VERSION >= (1, 4):
        from django.test.utils import override_settings
        with override_settings():
            tower.deactivate_all()
            tower.activate('xx')
            # String is the same because it couldn't find
            # SETTINGS_MODULE and thus didn't pick up the right .mo
            # files.
            eq_(_('this is a test'), 'this is a test')
            tower.deactivate_all()
Example #2
0
def test_activate_with_override_settings_and_django_14():
    # Django 1.4 includes a handy override_settings helper. When you
    # use that, it must not include SETTINGS_MODULE in the settings.
    # This tests that activating a locale doesn't throw an
    # AssertionError because there's no SETTINGS_MODULE in settings.
    if django.VERSION >= (1, 4):
        from django.test.utils import override_settings
        with override_settings():
            tower.deactivate_all()
            tower.activate('xx')
            # String is the same because it couldn't find
            # SETTINGS_MODULE and thus didn't pick up the right .mo
            # files.
            eq_(_('this is a test'), 'this is a test')
            tower.deactivate_all()
Example #3
0
def test_cached_activate():
    """
    Make sure the locale is always activated properly, even when we hit a
    cached version.
    """
    tower.deactivate_all()
    tower.activate("fr")
    eq_(translation.get_language(), "fr")
    tower.activate("fa")
    eq_(translation.get_language(), "fa")
    tower.activate("fr")
    eq_(translation.get_language(), "fr")
    tower.activate("de")
    eq_(translation.get_language(), "de")
    tower.activate("fr")
    eq_(translation.get_language(), "fr")
    tower.activate("fa")
    eq_(translation.get_language(), "fa")
Example #4
0
def test_cached_activate():
    """
    Make sure the locale is always activated properly, even when we hit a
    cached version.
    """
    tower.deactivate_all()
    tower.activate('fr')
    eq_(translation.get_language(), 'fr')
    tower.activate('fa')
    eq_(translation.get_language(), 'fa')
    tower.activate('fr')
    eq_(translation.get_language(), 'fr')
    tower.activate('de')
    eq_(translation.get_language(), 'de')
    tower.activate('fr')
    eq_(translation.get_language(), 'fr')
    tower.activate('fa')
    eq_(translation.get_language(), 'fa')
Example #5
0
def teardown():
    tower.deactivate_all()
Example #6
0
def test_activate():
    tower.deactivate_all()
    tower.activate("xx")
    eq_(_("this is a test"), "you ran a test!")
    tower.deactivate_all()
Example #7
0
def test_activate():
    tower.deactivate_all()
    tower.activate('xx')
    eq_(_('this is a test'), 'you ran a test!')
    tower.deactivate_all()
Example #8
0
def teardown():
    tower.deactivate_all()
Example #9
0
def test_activate():
    tower.deactivate_all()
    tower.activate('xx')
    eq_(_('this is a test'), 'you ran a test!')
    tower.deactivate_all()