I have improved the tests to check for templates count from the db.
Here is the latest diff:
=== modified file 'lib/lp/registry/stories/webservice/xx-distroseries.txt'
--- lib/lp/registry/stories/webservice/xx-distroseries.txt 2010-05-17 09:35:18 +0000
+++ lib/lp/registry/stories/webservice/xx-distroseries.txt 2010-05-18 14:51:40 +0000
@@ -107,9 +107,19 @@
All templates associated to a distribution series are available at the
'all_translation_templates' collection link.
=== modified file 'lib/lp/registry/stories/webservice/xx-source-package.txt'
--- lib/lp/registry/stories/webservice/xx-source-package.txt 2010-05-17 09:35:18 +0000
+++ lib/lp/registry/stories/webservice/xx-source-package.txt 2010-05-18 15:23:51 +0000
@@ -130,10 +130,27 @@
All translation templates for a source package are available at the
'all_translation_templates' collection link.
=== modified file 'lib/lp/translations/interfaces/webservice.py'
--- lib/lp/translations/interfaces/webservice.py 2010-03-08 21:06:34 +0000
+++ lib/lp/translations/interfaces/webservice.py 2010-05-17 10:27:14 +0000
@@ -1,6 +1,8 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+# pylint: disable-msg=W0611
+
"""All the interfaces that are exposed through the webservice."""
from lp.translations.interfaces.translationimportqueue import (
Hi,
I have improved the tests to check for templates count from the db.
Here is the latest diff:
=== modified file 'lib/lp/ registry/ stories/ webservice/ xx-distroseries .txt' registry/ stories/ webservice/ xx-distroseries .txt 2010-05-17 09:35:18 +0000 registry/ stories/ webservice/ xx-distroseries .txt 2010-05-18 14:51:40 +0000 on_templates' collection link.
--- lib/lp/
+++ lib/lp/
@@ -107,9 +107,19 @@
All templates associated to a distribution series are available at the
'all_translati
+ >>> from zope.component import getUtility launchpad. interfaces. launchpad import ( rities) .interfaces. potemplate import IPOTemplateSet ILaunchpadCeleb rities) .ubuntu. getSeries( 'hoary' ) IPOTemplateSet) .getSubset( distroseries= hoary) templates) ) _templates = anon_webservice .get( hoary/all_ translation_ templates' ).jsonBody( ) _templates[ 'total_ size'] _templates[ 'total_ size'] translation_ templates[ 'entries' ][0]['resource_ type_link' ]) .../#potemplate
+ >>> from canonical.
+ ... ILaunchpadCeleb
+ >>> from lp.translations
+ >>> login('<email address hidden>')
+ >>> hoary = getUtility(
+ >>> templates = getUtility(
+ >>> db_count = len(list(
+ >>> logout()
>>> all_translation
... '/ubuntu/
- >>> print all_translation
- 6
+ >>> api_count = all_translation
+ >>> api_count == db_count
+ True
>>> print(all_
http://
=== modified file 'lib/lp/ registry/ stories/ webservice/ xx-project- registry. txt' registry/ stories/ webservice/ xx-project- registry. txt 2010-05-17 09:35:18 +0000 registry/ stories/ webservice/ xx-project- registry. txt 2010-05-18 15:10:45 +0000 on_templates" will list all POTemplates associated with this
--- lib/lp/
+++ lib/lp/
@@ -897,11 +897,20 @@
"all_translati
product series.
+ .interfaces. potemplate import IPOTemplateSet .getSubset( productseries= foobadoo) templates) ) _templates = anon_webservice .get( n_templates_ collection_ link']) .jsonBody( ) _templates[ 'total_ size'] _templates[ 'total_ size'] translation_ templates[ 'entries' ][0]['resource_ type_link' ]) .../#potemplate
+ >>> from zope.component import getUtility
+ >>> from lp.translations
+ >>> login('<email address hidden>')
+ >>> templates = getUtility(
+ ... IPOTemplateSet)
+ >>> db_count = len(list(
+ >>> logout()
>>> all_translation
... babadoo_foobadoo[
... 'all_translatio
- >>> print all_translation
- 1
+ >>> api_count = all_translation
+ >>> api_count == db_count
+ True
>>> print(all_
http://
=== modified file 'lib/lp/ registry/ stories/ webservice/ xx-source- package. txt' registry/ stories/ webservice/ xx-source- package. txt 2010-05-17 09:35:18 +0000 registry/ stories/ webservice/ xx-source- package. txt 2010-05-18 15:23:51 +0000 on_templates' collection link.
--- lib/lp/
+++ lib/lp/
@@ -130,10 +130,27 @@
All translation templates for a source package are available at the
'all_translati
+ launchpad. interfaces. launchpad import ( rities) interfaces. sourcepackagena me import ( ameSet) .interfaces. potemplate import IPOTemplateSet ILaunchpadCeleb rities) .ubuntu. getSeries( 'hoary' ) ISourcePackageN ameSet) ['evolution' ] .getSubset( me=evolution_ package) templates) ) _templates = anon_webservice .get( 'self_link' ] + '/all_translati on_templates' ).jsonBody( ) _templates[ 'total_ size'] _templates[ 'total_ size'] translation_ templates[ 'entries' ][0]['resource_ type_link' ]) .../#potemplate
+ >>> from zope.component import getUtility
+ >>> from canonical.
+ ... ILaunchpadCeleb
+ >>> from lp.registry.
+ ... ISourcePackageN
+ >>> from lp.translations
+ >>> login('<email address hidden>')
+ >>> hoary = getUtility(
+ >>> evolution_package = getUtility(
+ >>> templates = getUtility(
+ ... IPOTemplateSet)
+ ... distroseries=hoary,
+ ... sourcepackagena
+ >>> db_count = len(list(
+ >>> logout()
>>> all_translation
... evolution[
- >>> print all_translation
- 3
+ >>> api_count = all_translation
+ >>> api_count == db_count
+ True
>>> print(all_
http://
=== modified file 'lib/lp/ translations/ interfaces/ webservice. py' translations/ interfaces/ webservice. py 2010-03-08 21:06:34 +0000 translations/ interfaces/ webservice. py 2010-05-17 10:27:14 +0000
--- lib/lp/
+++ lib/lp/
@@ -1,6 +1,8 @@
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
+# pylint: disable-msg=W0611
+
"""All the interfaces that are exposed through the webservice."""
from lp.translations .interfaces. translationimpo rtqueue import (