I've went with IDoNotSnapshot after all: that's what also test_bugs_webservice is using. Since there was missing documentation for translators property, I've added that too. === modified file 'lib/lp/services/worlddata/doc/language.txt' --- lib/lp/services/worlddata/doc/language.txt 2010-02-17 10:39:16 +0000 +++ lib/lp/services/worlddata/doc/language.txt 2010-04-15 11:52:13 +0000 @@ -260,8 +260,40 @@ English name for a language including op Serbian ("Latn" variant) +translators +=========== + +Property `translators` contains the list of `Person`s who are considered +translators for this language. + + >>> sr = language_set.getLanguageByCode('sr') + >>> list(sr.translators) + [] + +To be considered a translator, they must have done some translations and +have the language among their preferred languages. + + >>> translator = factory.makePerson(name=u'serbian-translator') + >>> translator.addLanguage(sr) + >>> from canonical.testing import LaunchpadZopelessLayer + >>> LaunchpadZopelessLayer.commit() + + # We need to fake some Karma. + >>> from lp.registry.model.karma import KarmaCategory, KarmaCache + >>> LaunchpadZopelessLayer.switchDbUser('karma') + >>> translations_category = KarmaCategory.selectOne( + ... KarmaCategory.name=='translations') + >>> karma = KarmaCache(person=translator, + ... category=translations_category, + ... karmavalue=1) + >>> LaunchpadZopelessLayer.commit() + >>> LaunchpadZopelessLayer.switchDbUser('launchpad') + >>> [translator.name for translator in sr.translators] + [u'serbian-translator'] + + ========= -countries +Countries ========= Property holding a list of countries a language is spoken in, and allowing === modified file 'lib/lp/services/worlddata/tests/test_doc.py' --- lib/lp/services/worlddata/tests/test_doc.py 2009-06-30 16:56:07 +0000 +++ lib/lp/services/worlddata/tests/test_doc.py 2010-04-15 11:51:21 +0000 @@ -6,9 +6,20 @@ Run the doctests and pagetests. """ import os + +from canonical.launchpad.testing.systemdocs import ( + LayeredDocFileSuite, setUp, tearDown) +from canonical.testing import LaunchpadZopelessLayer + from lp.services.testing import build_test_suite here = os.path.dirname(os.path.realpath(__file__)) +special = { + 'language.txt': LayeredDocFileSuite( + '../doc/language.txt', + layer=LaunchpadZopelessLayer, + setUp=setUp, tearDown=tearDown), + } def test_suite(): - return build_test_suite(here) + return build_test_suite(here, special) === added file 'lib/lp/services/worlddata/tests/test_language.py' --- lib/lp/services/worlddata/tests/test_language.py 1970-01-01 00:00:00 +0000 +++ lib/lp/services/worlddata/tests/test_language.py 2010-04-15 11:49:44 +0000 @@ -0,0 +1,21 @@ +# Copyright 2010 Canonical Ltd. This software is licensed under the +# GNU Affero General Public License version 3 (see the file LICENSE). + +__metaclass__ = type + +from canonical.testing import FunctionalLayer +from lazr.lifecycle.interfaces import IDoNotSnapshot +from lp.services.worlddata.interfaces.language import ILanguage +from lp.testing import TestCaseWithFactory + + +class TestLanguageWebservice(TestCaseWithFactory): + """Test Language web service API.""" + + layer = FunctionalLayer + + def test_translators(self): + self.failUnless( + IDoNotSnapshot.providedBy(ILanguage['translators']), + "ILanguage.translators should not be included in snapshots, " + "see bug 553093.")