Merge lp:~henninge/launchpad/db-devel-688479-kill-ut-in-tests-1 into lp:launchpad/db-devel

Proposed by Henning Eggers on 2010-12-10
Status: Merged
Approved by: Henning Eggers on 2010-12-10
Approved revision: no longer in the source branch.
Merged at revision: 10054
Proposed branch: lp:~henninge/launchpad/db-devel-688479-kill-ut-in-tests-1
Merge into: lp:launchpad/db-devel
Diff against target: 453 lines (+61/-55)
14 files modified
lib/lp/translations/browser/tests/language-views.txt (+3/-3)
lib/lp/translations/browser/tests/test_persontranslationview.py (+1/-1)
lib/lp/translations/browser/tests/test_translationmessage_view.py (+4/-4)
lib/lp/translations/doc/gettext-check-messages.txt (+3/-4)
lib/lp/translations/doc/translationmessage-destroy.txt (+1/-1)
lib/lp/translations/doc/translationmessage.txt (+2/-2)
lib/lp/translations/stories/standalone/xx-person-activity.txt (+5/-3)
lib/lp/translations/stories/standalone/xx-pofile-details.txt (+5/-5)
lib/lp/translations/stories/standalone/xx-translations-to-complete.txt (+2/-2)
lib/lp/translations/stories/standalone/xx-translations-to-review.txt (+1/-1)
lib/lp/translations/tests/test_potmsgset.py (+22/-16)
lib/lp/translations/tests/test_translatablemessage.py (+2/-2)
lib/lp/translations/tests/test_translationmessage.py (+9/-9)
lib/lp/translations/tests/test_translationsperson.py (+1/-2)
To merge this branch: bzr merge lp:~henninge/launchpad/db-devel-688479-kill-ut-in-tests-1
Reviewer Review Type Date Requested Status
Abel Deuring (community) code 2010-12-10 Approve on 2010-12-10
Review via email: mp+43342@code.launchpad.net

Commit Message

[r=adeuring][ui=none][bug=688479][incr] Replace makeTranslationMessage with makeCurrentTranslationMessage

Description of the Change

= Bug 688479, Part 1 =

This branch replaces all uses of makeTranslationMessage with makeCurrentTranslationMessage which does not use updateTranslation to create translations. It uses new methods that have been implemented to replace the old and complex updateTranslation method. They also implement the new model for sharing translations between upstream and Ubuntu. This is part of the work that was done in the recife branch which has now been merged into db-devel (again).

== Details ==

In most cases the new factory method can directly replace the old one. Sometimes parameters need to be renamed. In two cases the methods under test have not yet been converted to the new model so that the tests had to be disabled until that is fixed.

== Tests ==

Only tests were changed, so the branch can be verified by running those tests.

bin/test -vvcm lp.translations \
  -t language-views.txt \
  -t test_persontranslationview.py \
  -t test_translationmessage_view.py \
  -t gettext-check-messages.txt \
  -t translationmessage-destroy.txt \
  -t translationmessage.txt \
  -t xx-person-activity.txt \
  -t xx-pofile-details.txt \
  -t xx-translations-to-complete.txt \
  -t xx-translations-to-review.txt \
  -t test_potmsgset.py \
  -t test_translatablemessage.py \
  -t test_translationmessage.py \
  -t test_translationsperson.py

== Lint ==

I removed some lint.

To post a comment you must log in.
Abel Deuring (adeuring) wrote :

(13:34:23) adeuring: henninge: overall, the changes look good. But the disabled tests conern me a bit: Couldn't you simply use the old factory method makeTranslationMessage() unitl the new method can be properly used in these tests?
(13:34:33) adeuring: s/conern/concern/
(13:46:03) 18VABWLF0 hat den Raum verlassen (quit: Ping timeout: 240 seconds).
(13:52:37) henninge: adeuring: yes, I could. OTHOH that bug will be the next to fix after this bug and I want to remove the old factory method in the next branch for this bug.
(13:52:59) henninge: adeuring: sorry for being afk, btw.
(13:54:44) adeuring: henninge: well, you can fix the factory method first and then change the tests. I am perhaps a bit paranoid, but I remeber a somewhat weird bug in Zope 2 which looked like somebody made a short coffee break while working on a feature but never properly finished that feature aufter the coffee break ;)
(13:55:13) henninge: ;-)
(13:55:23) henninge: The factory method will not be fixed but removed.
(13:56:23) adeuring: henninge: right, what I meant is: I think you should still use the old mehtod until the new one works properly for the currently disabled tests
(13:56:54) henninge: adeuring: we keep running into these hen-egg problems with this branch. ;)
(13:57:18) henninge: In this case it's not the factory that needs to be fixed but the method under test is still referring to the old model.
(13:58:15) henninge: adeuring: but I can do that, if you insist ;-)
(13:58:16) henninge: np
(13:58:33) henninge: I'll have to keep the old factory around a little longer.
(13:58:46) adeuring: henninge: I would feel defeinetly better if all tests stay enabled ;)
(13:59:07) henninge: adeuring: It is important that you feel well!
(13:59:27) adeuring: henninge: ok, so, r=me

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/browser/tests/language-views.txt'
2--- lib/lp/translations/browser/tests/language-views.txt 2010-08-31 18:10:51 +0000
3+++ lib/lp/translations/browser/tests/language-views.txt 2010-12-10 13:47:12 +0000
4@@ -156,11 +156,11 @@
5 accounts.
6
7 >>> for translator in translators:
8- ... translation = factory.makeTranslationMessage(
9+ ... translation = factory.makeCurrentTranslationMessage(
10 ... pofile=pofile, translator=translator, potmsgset=potmsgset)
11- >>> translation = factory.makeTranslationMessage(
12+ >>> translation = factory.makeCurrentTranslationMessage(
13 ... pofile=pofile, translator=translator_merged, potmsgset=potmsgset)
14- >>> translation = factory.makeTranslationMessage(
15+ >>> translation = factory.makeCurrentTranslationMessage(
16 ... pofile=pofile, translator=translator_main, potmsgset=potmsgset)
17
18 Langauge.translators is Monkey-patched to avoid fetching KarmaCache.
19
20=== modified file 'lib/lp/translations/browser/tests/test_persontranslationview.py'
21--- lib/lp/translations/browser/tests/test_persontranslationview.py 2010-10-04 19:50:45 +0000
22+++ lib/lp/translations/browser/tests/test_persontranslationview.py 2010-12-10 13:47:12 +0000
23@@ -55,7 +55,7 @@
24 if previously_worked_on:
25 potmsgset = self.factory.makePOTMsgSet(
26 potemplate=pofile.potemplate, singular='x', sequence=1)
27- self.factory.makeTranslationMessage(
28+ self.factory.makeCurrentTranslationMessage(
29 potmsgset=potmsgset, pofile=pofile,
30 translator=self.view.context, translations=['y'])
31
32
33=== modified file 'lib/lp/translations/browser/tests/test_translationmessage_view.py'
34--- lib/lp/translations/browser/tests/test_translationmessage_view.py 2010-12-02 16:13:51 +0000
35+++ lib/lp/translations/browser/tests/test_translationmessage_view.py 2010-12-10 13:47:12 +0000
36@@ -117,7 +117,7 @@
37 allows for the "In Ubuntu" or "In Upstream" line to be grayed out
38 upon dismissal. This flag is only used in the view to select the
39 right css class to achieve that.
40-
41+
42 :param can_confirm_and_dismiss: The expected stage of that flag.
43 :param can_dismiss_on_empty: The expected stage of that flag.
44 :param can_dismiss_on_plural: The expected stage of that flag.
45@@ -305,7 +305,7 @@
46 layer = ZopelessDatabaseLayer
47
48 def _makeView(self):
49- message = self.factory.makeTranslationMessage()
50+ message = self.factory.makeCurrentTranslationMessage()
51 request = LaunchpadTestRequest()
52 view = CurrentTranslationMessagePageView(message, request)
53 view.lock_timestamp = datetime.now(pytz.utc)
54@@ -415,7 +415,7 @@
55 # message, if any.
56 new_translations = {0: self.getUniqueString()}
57 original_translations = {0: self.getUniqueString()}
58- current_message = self.factory.makeTranslationMessage(
59+ current_message = self.factory.makeCurrentTranslationMessage(
60 translations=original_translations)
61 self.assertEqual(
62 original_translations,
63@@ -435,7 +435,7 @@
64 # empty string.
65 new_translations = {1: self.getUniqueString()}
66 original_translations = {0: self.getUniqueString()}
67- current_message = self.factory.makeTranslationMessage(
68+ current_message = self.factory.makeCurrentTranslationMessage(
69 translations=original_translations)
70 self.assertEqual(
71 {1: u''},
72
73=== modified file 'lib/lp/translations/doc/gettext-check-messages.txt'
74--- lib/lp/translations/doc/gettext-check-messages.txt 2010-12-02 16:13:51 +0000
75+++ lib/lp/translations/doc/gettext-check-messages.txt 2010-12-10 13:47:12 +0000
76@@ -68,15 +68,14 @@
77 The sample message has an upstream translation, and an Ubuntu
78 in Launchpad that differs from the upstream one.
79
80- >>> ubuntu_message = factory.makeTranslationMessage(
81+ >>> ubuntu_message = factory.makeCurrentTranslationMessage(
82 ... pofile=pofile, potmsgset=potmsgset, translator=template.owner,
83 ... reviewer=template.owner, translations=[u'%d c'])
84 >>> ubuntu_message = removeSecurityProxy(ubuntu_message)
85
86- >>> upstream_message = factory.makeTranslationMessage(
87+ >>> upstream_message = factory.makeCurrentTranslationMessage(
88 ... pofile=pofile, potmsgset=potmsgset, translator=template.owner,
89- ... reviewer=template.owner, translations=[u'%d i'],
90- ... lock_timestamp=datetime.now(UTC))
91+ ... reviewer=template.owner, translations=[u'%d i'])
92 >>> upstream_message = removeSecurityProxy(upstream_message)
93
94 >>> upstream_message.is_current_ubuntu = False
95
96=== modified file 'lib/lp/translations/doc/translationmessage-destroy.txt'
97--- lib/lp/translations/doc/translationmessage-destroy.txt 2010-10-18 22:24:59 +0000
98+++ lib/lp/translations/doc/translationmessage-destroy.txt 2010-12-10 13:47:12 +0000
99@@ -58,7 +58,7 @@
100 ... 'sr', stable_potemplate)
101 >>> potmsgset = factory.makePOTMsgSet(devel_potemplate, sequence=1)
102 >>> potmsgset.setSequence(stable_potemplate, 1)
103- >>> tm = factory.makeTranslationMessage(
104+ >>> tm = factory.makeCurrentTranslationMessage(
105 ... pofile=devel_sr_pofile,
106 ... potmsgset=potmsgset,
107 ... translations=[u"blah"])
108
109=== modified file 'lib/lp/translations/doc/translationmessage.txt'
110--- lib/lp/translations/doc/translationmessage.txt 2010-12-02 16:13:51 +0000
111+++ lib/lp/translations/doc/translationmessage.txt 2010-12-10 13:47:12 +0000
112@@ -21,7 +21,7 @@
113 associated POFile and POTMsgSet. TranslationMessage and
114 DummyTranslationMessage both implement ITranslationMessage:
115
116- >>> translationmessage = factory.makeTranslationMessage(
117+ >>> translationmessage = factory.makeCurrentTranslationMessage(
118 ... potmsgset=potmsgset, pofile=pofile_es)
119 >>> verifyObject(ITranslationMessage, translationmessage)
120 True
121@@ -233,7 +233,7 @@
122 >>> plural_potmsgset = factory.makePOTMsgSet(potemplate=potemplate,
123 ... singular=u"%d contact",
124 ... plural=u"%d contacts")
125- >>> plural_message = factory.makeTranslationMessage(
126+ >>> plural_message = factory.makeCurrentTranslationMessage(
127 ... potmsgset=plural_potmsgset, pofile=pofile_es,
128 ... translations=[u'%d contacto', u'%d contactos'])
129 >>> plural_message.translations
130
131=== modified file 'lib/lp/translations/stories/standalone/xx-person-activity.txt'
132--- lib/lp/translations/stories/standalone/xx-person-activity.txt 2009-09-18 15:42:19 +0000
133+++ lib/lp/translations/stories/standalone/xx-person-activity.txt 2010-12-10 13:47:12 +0000
134@@ -19,7 +19,6 @@
135 listed which Carlos has contributed to.
136
137 # Prints a heading and formatted list of POFiles and latest submissions.
138- >>> import re
139 >>> def print_activity_list(listing):
140 ... for row in listing.findAll('tr'):
141 ... print extract_text(row)
142@@ -42,7 +41,8 @@
143 Clicking one of the entries takes you to a page listing all of Carlos'
144 contributions to the selected translation.
145
146- >>> alsa_utils_link = 'Spanish (es) translation of alsa-utils in alsa-utils trunk'
147+ >>> alsa_utils_link = (
148+ ... 'Spanish (es) translation of alsa-utils in alsa-utils trunk')
149 >>> anon_browser.getLink(alsa_utils_link).click()
150 >>> print anon_browser.title
151 Translations by ... in...Spanish (es) translation...
152@@ -58,7 +58,9 @@
153
154 >>> login('carlos@canonical.com')
155 >>> ab = factory.makePerson(name='a+b')
156- >>> message = factory.makeTranslationMessage(translator=ab)
157+ >>> sr_pofile = factory.makePOFile('sr')
158+ >>> message = factory.makeCurrentTranslationMessage(
159+ ... pofile=sr_pofile, translator=ab)
160 >>> person_url = canonical_url(ab, rootsite='translations')
161 >>> logout()
162
163
164=== modified file 'lib/lp/translations/stories/standalone/xx-pofile-details.txt'
165--- lib/lp/translations/stories/standalone/xx-pofile-details.txt 2010-12-03 12:47:47 +0000
166+++ lib/lp/translations/stories/standalone/xx-pofile-details.txt 2010-12-10 13:47:12 +0000
167@@ -102,8 +102,8 @@
168 A POTMsgSet sequence number is also a link to edit a translation.
169
170 >>> anon_browser.getLink('14.').click()
171- >>> anon_browser.url
172- 'http://translations.launchpad.dev/evolution/trunk/+pots/evolution-2.2/es/14/+translate'
173+ >>> print anon_browser.url
174+ http://.../evolution/trunk/+pots/evolution-2.2/es/14/+translate
175 >>> print anon_browser.title
176 Browsing Spanish translation...
177
178@@ -131,7 +131,7 @@
179 Merged accounts
180 ---------------
181
182-On the overview page of each translation pofile, users will not see merged
183+On the overview page of each translation pofile, users will not see merged
184 accounts.
185
186 We'll create two new accounts to demonstrate this.
187@@ -152,9 +152,9 @@
188 >>> language_code = 'es'
189 >>> pofile = factory.makePOFile(language_code, potemplate=template)
190 >>> potmsgset = factory.makePOTMsgSet(template)
191- >>> translation = factory.makeTranslationMessage(pofile=pofile,
192+ >>> translation = factory.makeCurrentTranslationMessage(pofile=pofile,
193 ... translator=merged_translator, potmsgset=potmsgset)
194- >>> translation = factory.makeTranslationMessage(pofile=pofile,
195+ >>> translation = factory.makeCurrentTranslationMessage(pofile=pofile,
196 ... translator=translator, potmsgset=potmsgset)
197 >>> from zope.security.proxy import removeSecurityProxy
198 >>> removeSecurityProxy(merged_translator).merged = translator
199
200=== modified file 'lib/lp/translations/stories/standalone/xx-translations-to-complete.txt'
201--- lib/lp/translations/stories/standalone/xx-translations-to-complete.txt 2009-11-25 16:51:53 +0000
202+++ lib/lp/translations/stories/standalone/xx-translations-to-complete.txt 2010-12-10 13:47:12 +0000
203@@ -19,7 +19,7 @@
204
205 >>> potmsgset = factory.makePOTMsgSet(
206 ... potemplate=template, singular='a', sequence=1)
207- >>> message = factory.makeTranslationMessage(
208+ >>> message = factory.makeCurrentTranslationMessage(
209 ... potmsgset=potmsgset, pofile=pofile, translator=jean,
210 ... translations=['un'])
211
212@@ -77,7 +77,7 @@
213 ... ILaunchpadCelebrities)
214 >>> pofile = factory.makePOFile('ru')
215 >>> rosetta_experts = getUtility(ILaunchpadCelebrities).rosetta_experts
216- >>> message = factory.makeTranslationMessage(
217+ >>> message = factory.makeCurrentTranslationMessage(
218 ... pofile=pofile, translator=rosetta_experts, translations=['x'])
219 >>> logout()
220
221
222=== modified file 'lib/lp/translations/stories/standalone/xx-translations-to-review.txt'
223--- lib/lp/translations/stories/standalone/xx-translations-to-review.txt 2009-08-31 13:04:32 +0000
224+++ lib/lp/translations/stories/standalone/xx-translations-to-review.txt 2010-12-10 13:47:12 +0000
225@@ -46,7 +46,7 @@
226 ... """Let `user` add a suggestion to `pofile`."""
227 ... potmsgset = factory.makePOTMsgSet(
228 ... potemplate=pofile.potemplate, singular='x', sequence=1)
229- ... factory.makeTranslationMessage(
230+ ... factory.makeCurrentTranslationMessage(
231 ... potmsgset=potmsgset, pofile=pofile, translator=user,
232 ... translations=['y'])
233
234
235=== modified file 'lib/lp/translations/tests/test_potmsgset.py'
236--- lib/lp/translations/tests/test_potmsgset.py 2010-12-02 16:13:51 +0000
237+++ lib/lp/translations/tests/test_potmsgset.py 2010-12-10 13:47:12 +0000
238@@ -165,9 +165,9 @@
239
240 # A diverged (translation.potemplate != None) English translation
241 # is not used as a singular_text.
242- translation = self.factory.makeTranslationMessage(
243+ translation = self.factory.makeCurrentTranslationMessage(
244 pofile=en_pofile, potmsgset=potmsgset,
245- translations=[DIVERGED_ENGLISH_STRING], force_diverged=True)
246+ translations=[DIVERGED_ENGLISH_STRING], diverged=True)
247 self.assertEquals(potmsgset.singular_text, ENGLISH_STRING)
248
249 def test_getCurrentTranslationMessageOrDummy_returns_upstream_tm(self):
250@@ -219,6 +219,8 @@
251 self.assertTrue(dummy.is_current_ubuntu)
252 self.assertFalse(dummy.is_current_upstream)
253
254+ # XXX henninge 2010-12-10 bug=688519: getCurrentTranslationMessage is not
255+ # side-aware yet.
256 def test_getCurrentTranslationMessage(self):
257 """Test how shared and diverged current translation messages
258 interact."""
259@@ -244,6 +246,9 @@
260 self.assertEquals(self.potmsgset.getCurrentTranslationMessage(
261 self.stable_potemplate, serbian), shared_translation)
262
263+
264+ # XXX henninge 2010-12-10 bug=688519: The meaning of imported is gone
265+ # and so this test and the method it is testing need to be updated.
266 def test_getImportedTranslationMessage(self):
267 """Test how shared and diverged current translation messages
268 interact."""
269@@ -286,8 +291,8 @@
270 shared_translation)
271
272 # Adding a diverged translation doesn't break getSharedTM.
273- diverged_translation = self.factory.makeTranslationMessage(
274- pofile=sr_pofile, potmsgset=self.potmsgset, force_diverged=True)
275+ diverged_translation = self.factory.makeCurrentTranslationMessage(
276+ pofile=sr_pofile, potmsgset=self.potmsgset, diverged=True)
277 self.assertEquals(
278 self.potmsgset.getSharedTranslationMessage(serbian),
279 shared_translation)
280@@ -506,9 +511,9 @@
281 # If there's a current, diverged translation, and an imported
282 # non-current one, it's changed in Ubuntu.
283 imported_shared.makeCurrentUbuntu(False)
284- current_diverged = self.factory.makeTranslationMessage(
285+ current_diverged = self.factory.makeCurrentTranslationMessage(
286 pofile=sr_pofile, potmsgset=self.potmsgset,
287- is_current_upstream=False)
288+ current_other=False)
289 self.assertEquals(
290 self.potmsgset.hasTranslationChangedInLaunchpad(
291 self.devel_potemplate, serbian),
292@@ -819,10 +824,10 @@
293 self.pofile = self.factory.makePOFile('eo', self.potemplate)
294 # Set up some translation messages with dummy timestamps that will be
295 # changed in the tests.
296- self.translation = self.factory.makeTranslationMessage(
297+ self.translation = self.factory.makeCurrentTranslationMessage(
298 removeSecurityProxy(self.pofile), self.potmsgset,
299 translations=[u'trans1'], reviewer=self.factory.makePerson(),
300- is_current_upstream=True, date_updated=self.now())
301+ current_other=True, date_created=self.now())
302 self.suggestion1 = self.factory.makeSuggestion(
303 self.pofile, self.potmsgset, translations=[u'sugg1'],
304 date_created=self.now())
305@@ -1428,8 +1433,9 @@
306
307 credits = self.factory.makePOTMsgSet(
308 self.potemplate, u'translator-credits', sequence=1)
309- translation = self.factory.makeTranslationMessage(eo_pofile, credits,
310- translations=[imported_credits], is_current_upstream=True)
311+ self.factory.makeCurrentTranslationMessage(
312+ eo_pofile, credits, translations=[imported_credits],
313+ current_other=True)
314
315 eo_translation = credits.getCurrentTranslationMessage(
316 self.potemplate, eo_pofile.language)
317@@ -1598,9 +1604,9 @@
318 pofile, potmsgset = self._makePOFileAndPOTMsgSet()
319 owner = pofile.potemplate.owner
320 translation = {0: self.factory.getUniqueString()}
321- diverged_message = self.factory.makeTranslationMessage(
322+ diverged_message = self.factory.makeCurrentTranslationMessage(
323 pofile=pofile, potmsgset=potmsgset, translator=owner,
324- translations=translation, force_diverged=True)
325+ translations=translation, diverged=True)
326
327 suggestion = potmsgset.submitSuggestion(pofile, owner, translation)
328
329@@ -1618,9 +1624,9 @@
330 productseries=series2, name=pofile.potemplate.name)
331 pofile2 = template2.getPOFileByLang(pofile.language.code)
332 translation = {0: self.factory.getUniqueString()}
333- diverged_message = self.factory.makeTranslationMessage(
334+ diverged_message = self.factory.makeCurrentTranslationMessage(
335 pofile=pofile2, potmsgset=potmsgset, translator=owner,
336- translations=translation, force_diverged=True)
337+ translations=translation, diverged=True)
338
339 suggestion = potmsgset.submitSuggestion(pofile, owner, translation)
340
341@@ -1637,9 +1643,9 @@
342 shared_message = self.factory.makeSharedTranslationMessage(
343 pofile=pofile, potmsgset=potmsgset, translator=owner,
344 translations=translation)
345- diverged_message = self.factory.makeTranslationMessage(
346+ diverged_message = self.factory.makeCurrentTranslationMessage(
347 pofile=pofile, potmsgset=potmsgset, translator=owner,
348- translations=translation2, force_diverged=True)
349+ translations=translation2, diverged=True)
350
351 suggestion = potmsgset.submitSuggestion(pofile, owner, translation)
352
353
354=== modified file 'lib/lp/translations/tests/test_translatablemessage.py'
355--- lib/lp/translations/tests/test_translatablemessage.py 2010-12-02 16:13:51 +0000
356+++ lib/lp/translations/tests/test_translatablemessage.py 2010-12-10 13:47:12 +0000
357@@ -163,9 +163,9 @@
358 self.external_pofile = self.factory.makePOFile(
359 potemplate=self.external_potemplate, language_code='eo')
360
361- self.external_suggestion = self.factory.makeTranslationMessage(
362+ self.external_suggestion = self.factory.makeCurrentTranslationMessage(
363 pofile=self.external_pofile, potmsgset=self.external_potmsgset)
364- self.external_current = self.factory.makeTranslationMessage(
365+ self.external_current = self.factory.makeCurrentTranslationMessage(
366 pofile=self.external_pofile, potmsgset=self.external_potmsgset)
367
368 self.message = TranslatableMessage(self.potmsgset, self.pofile)
369
370=== modified file 'lib/lp/translations/tests/test_translationmessage.py'
371--- lib/lp/translations/tests/test_translationmessage.py 2010-12-02 16:13:51 +0000
372+++ lib/lp/translations/tests/test_translationmessage.py 2010-12-10 13:47:12 +0000
373@@ -38,7 +38,7 @@
374 layer = ZopelessDatabaseLayer
375
376 def test_baseline(self):
377- message = self.factory.makeTranslationMessage()
378+ message = self.factory.makeCurrentTranslationMessage()
379 verifyObject(ITranslationMessage, message)
380
381 def test_dummy_translationmessage(self):
382@@ -51,15 +51,15 @@
383 # ITranslationMessage.is_diverged is a little helper to let you
384 # say "message.is_diverged" which can be clearer than
385 # "message.potemplate is not None."
386- message = self.factory.makeTranslationMessage(force_diverged=False)
387+ message = self.factory.makeCurrentTranslationMessage(diverged=False)
388 self.assertFalse(message.is_diverged)
389
390 def test_is_diverged_true(self):
391- message = self.factory.makeTranslationMessage(force_diverged=True)
392+ message = self.factory.makeCurrentTranslationMessage(diverged=True)
393 self.assertTrue(message.is_diverged)
394
395 def test_markReviewed(self):
396- message = self.factory.makeTranslationMessage()
397+ message = self.factory.makeCurrentTranslationMessage()
398 reviewer = self.factory.makePerson()
399 tomorrow = datetime.now(UTC) + timedelta(days=1)
400
401@@ -484,14 +484,14 @@
402 def test_getOnePOFile(self):
403 language = self.factory.makeLanguage('sr@test')
404 pofile = self.factory.makePOFile(language.code)
405- tm = self.factory.makeTranslationMessage(pofile=pofile)
406+ tm = self.factory.makeCurrentTranslationMessage(pofile=pofile)
407 self.assertEquals(pofile, tm.getOnePOFile())
408
409 def test_getOnePOFile_shared(self):
410 language = self.factory.makeLanguage('sr@test')
411 pofile1 = self.factory.makePOFile(language.code)
412 pofile2 = self.factory.makePOFile(language.code)
413- tm = self.factory.makeTranslationMessage(pofile=pofile1)
414+ tm = self.factory.makeCurrentTranslationMessage(pofile=pofile1)
415 # Share this POTMsgSet with the other POTemplate (and POFile).
416 tm.potmsgset.setSequence(pofile2.potemplate, 1)
417 self.assertTrue(tm.getOnePOFile() in [pofile1, pofile2])
418@@ -501,7 +501,7 @@
419 # is returned.
420 language = self.factory.makeLanguage('sr@test')
421 pofile = self.factory.makePOFile(language.code)
422- tm = self.factory.makeTranslationMessage(pofile=pofile)
423+ tm = self.factory.makeCurrentTranslationMessage(pofile=pofile)
424 tm.potmsgset.setSequence(pofile.potemplate, 0)
425 self.assertEquals(None, tm.getOnePOFile())
426
427@@ -543,12 +543,12 @@
428 'foe%d' % form
429 for form in xrange(TranslationConstants.MAX_PLURAL_FORMS)]
430
431- self.message = self.factory.makeTranslationMessage(
432+ self.message = self.factory.makeCurrentTranslationMessage(
433 pofile=self.pofile, potmsgset=self.potmsgset,
434 translations=self.translation_strings)
435 self.message.potemplate = self.template
436
437- self.other_message = self.factory.makeTranslationMessage(
438+ self.other_message = self.factory.makeCurrentTranslationMessage(
439 pofile=self.other_pofile, potmsgset=self.other_potmsgset,
440 translations=self.translation_strings)
441 self.other_message.potemplate = self.other_template
442
443=== modified file 'lib/lp/translations/tests/test_translationsperson.py'
444--- lib/lp/translations/tests/test_translationsperson.py 2010-10-04 19:50:45 +0000
445+++ lib/lp/translations/tests/test_translationsperson.py 2010-12-10 13:47:12 +0000
446@@ -22,6 +22,5 @@
447 person = self.factory.makePerson()
448 translationsperson = ITranslationsPerson(person)
449 self.assertFalse(translationsperson.hasTranslated())
450- self.factory.makeTranslationMessage(
451- translator=person, suggestion=True)
452+ self.factory.makeSuggestion(translator=person)
453 self.assertTrue(translationsperson.hasTranslated())

Subscribers

People subscribed via source and target branches

to status/vote changes: