[Product-Developers] Re: Help about writing a test
Daniel Nouri
daniel.nouri at gmail.com
Wed Feb 4 21:58:44 UTC 2009
Hello
Silvio writes:
> Hi all,
>
> I'm writing a doctest where I have to check that some translations are in
> place.
> I wrote this in a PloneTestCase doctest:
>
>>>> self.portal.portal_languages.addSupportedLanguage('fr')
>>>> self.portal.portal_languages.setDefaultLanguage('fr')
>>>> browser.open(self.portal.absolute_url())
>>>> "Accueil" in browser.contents
> True
>
> but it fails: the language is always English.
> I tried
>>>> self.portal.portal_languages.supported_langs = ['fr']
> and
>>>> import transaction
>>>> transaction.commit()
> but the test still fails.
> Doing the same in a debug session (and committing the transactions) yields the
> expected results (the site loads in French).
> How can I test languages other than english?
> Thanks for your help.
Try to install these Products in your test setup:
ztc.installProduct('PloneTranslations')
ztc.installProduct('PlacelessTranslationService')
They're usually not installed. I think for performance reasons.
--
http://danielnouri.org
More information about the Product-Developers
mailing list