Merge lp:~bac/launchpad/bugjam-579502 into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Approved by: Curtis Hovey
Approved revision: no longer in the source branch.
Merged at revision: 12145
Proposed branch: lp:~bac/launchpad/bugjam-579502
Merge into: lp:launchpad
Diff against target: 588 lines (+159/-59)
11 files modified
lib/lp/bugs/doc/bug-heat.txt (+12/-14)
lib/lp/bugs/doc/bugnotification-sending.txt (+10/-12)
lib/lp/bugs/doc/bugzilla-import.txt (+0/-3)
lib/lp/bugs/doc/initial-bug-contacts.txt (+0/-1)
lib/lp/bugs/model/bug.py (+10/-6)
lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt (+0/-5)
lib/lp/bugs/subscribers/bug.py (+1/-1)
lib/lp/bugs/tests/test_bugchanges.py (+4/-3)
lib/lp/bugs/tests/test_bugnotification.py (+114/-7)
lib/lp/bugs/tests/test_bugs_webservice.py (+6/-6)
lib/lp/bugs/tests/test_bugtask_search.py (+2/-1)
To merge this branch: bzr merge lp:~bac/launchpad/bugjam-579502
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+44302@code.launchpad.net

Commit message

[r=sinzui][ui=none][bug=579502] Do not send bug email to distro owner if the distro does not use Lauchpad for bugs.

Description of the change

= Summary =

If product or distro does not use Launchpad for bugs then the owner
should not be notified of bug state changes.

== Proposed fix ==

Check official_malone before adding the registrant.

== Pre-implementation notes ==

Talk with Curtis.

== Implementation details ==

As above.

== Tests ==

bin/test -vvm lp.bugs -t test_bugnotification

== Demo and Q/A ==

Create a distribution doesn't use Launchpad for bugs. Create a bugtask
affecting the distro as a different user. Ensure the distro owner does
not get an email. (Will this work? Need to find out about qastaging and
sending email.)

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/subscribers/bug.py
  lib/lp/bugs/tests/test_bugnotification.py
  lib/lp/bugs/model/bug.py

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This looks good to land. I think this will do a lot to stop the avalanche of email.

review: Approve (code)
Revision history for this message
Brad Crittenden (bac) wrote :

Curtis I discovered many more test that depended upon the pillar owner receiving email notification. The diff for the fixes is at http://pastebin.ubuntu.com/546917/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/doc/bug-heat.txt'
2--- lib/lp/bugs/doc/bug-heat.txt 2010-12-22 20:46:21 +0000
3+++ lib/lp/bugs/doc/bug-heat.txt 2010-12-23 19:45:24 +0000
4@@ -80,52 +80,52 @@
5
6 >>> changed = bug.setPrivate(True, bug_owner)
7 >>> bug.heat
8- 158
9+ 156
10
11 Setting the bug as security related adds another 250 heat points.
12
13 >>> changed = bug.setSecurityRelated(True)
14 >>> bug.heat
15- 408
16+ 406
17
18 Marking the bug public removes 150 heat points.
19
20 >>> changed = bug.setPrivate(False, bug_owner)
21 >>> bug.heat
22- 258
23+ 256
24
25 And marking it not security-related removes 250 points.
26
27 >>> changed = bug.setSecurityRelated(False)
28 >>> bug.heat
29- 8
30+ 6
31
32 Adding a subscriber to the bug increases its heat by 2 points.
33
34 >>> new_subscriber = factory.makePerson()
35 >>> subscription = bug.subscribe(new_subscriber, new_subscriber)
36 >>> bug.heat
37- 10
38+ 8
39
40 When a user unsubscribes, the bug loses 2 points of heat.
41
42 >>> bug.unsubscribe(new_subscriber, new_subscriber)
43 >>> bug.heat
44- 8
45+ 6
46
47 Should a user mark themselves as affected by the bug, it will gain 4
48 points of heat.
49
50 >>> bug.markUserAffected(new_subscriber)
51 >>> bug.heat
52- 12
53+ 10
54
55 If a user who was previously affected marks themself as not affected,
56 the bug loses 4 points of heat.
57
58 >>> bug.markUserAffected(new_subscriber, False)
59 >>> bug.heat
60- 8
61+ 6
62
63 If a user who wasn't affected by the bug marks themselve as explicitly
64 unaffected, the bug's heat doesn't change.
65@@ -133,7 +133,7 @@
66 >>> unaffected_person = factory.makePerson()
67 >>> bug.markUserAffected(unaffected_person, False)
68 >>> bug.heat
69- 8
70+ 6
71
72 Marking the bug as a duplicate will set its heat to zero, whilst also
73 adding 10 points of heat to the bug it duplicates, 6 points for the
74@@ -149,14 +149,14 @@
75 0
76
77 >>> duplicated_bug.heat
78- 16
79+ 14
80
81 Unmarking the bug as a duplicate restores its heat and updates the
82 duplicated bug's heat.
83
84 >>> bug.markAsDuplicate(None)
85 >>> bug.heat
86- 8
87+ 6
88
89 >>> duplicated_bug.heat
90 6
91@@ -184,7 +184,7 @@
92 ... old_value=bug.description, new_value='Some text')
93 >>> bug.addChange(change)
94 >>> bug.heat
95- 8
96+ 6
97
98
99 Getting bugs whose heat is outdated
100@@ -359,5 +359,3 @@
101 123
102 >>> print distro.max_bug_heat
103 456
104-
105-
106
107=== modified file 'lib/lp/bugs/doc/bugnotification-sending.txt'
108--- lib/lp/bugs/doc/bugnotification-sending.txt 2010-12-06 17:43:53 +0000
109+++ lib/lp/bugs/doc/bugnotification-sending.txt 2010-12-23 19:45:24 +0000
110@@ -303,7 +303,7 @@
111 <BLANKLINE>
112 ** Visibility changed to: Public.
113 <BLANKLINE>
114- --
115+ --
116 You received this bug notification because you are a member of Ubuntu
117 Team, which is the registrant for Ubuntu.
118 http://bugs.launchpad.dev/bugs/1
119@@ -582,8 +582,6 @@
120 0
121 >>> print err
122 DEBUG ...
123- INFO Notifying mark@example.com about bug 2.
124- ...
125 INFO Notifying support@ubuntu.com about bug 2.
126 ...
127 INFO Notifying test@canonical.com about bug 2.
128@@ -727,15 +725,12 @@
129 >>> for message in trigger_and_get_email_messages(bug_three):
130 ... message.get_all('X-Launchpad-Bug-Tags')
131 [u'layout-test']
132- [u'layout-test']
133
134 If we add a tag to bug three that will also be included in the header.
135 The tags will be space-separated to allow the list to be wrapped if it
136 gets over-long.
137
138 >>> switch_db_to_launchpad()
139-
140- >>> bug_three.unsubscribe(sample_person, sample_person)
141 >>> bug_three.tags = [u'layout-test', u'another-tag', u'yet-another']
142
143 >>> switch_db_to_bugnotification()
144@@ -756,6 +751,9 @@
145 >>> for message in trigger_and_get_email_messages(bug_three):
146 ... message.get_all('X-Launchpad-Bug-Tags')
147
148+ >>> switch_db_to_launchpad()
149+ >>> #bug_three.unsubscribe(sample_person, sample_person)
150+
151
152 The X-Launchpad-Bug-Private header
153 ----------------------------------
154@@ -769,7 +767,7 @@
155
156 >>> for message in trigger_and_get_email_messages(bug_three):
157 ... print message['To'], message.get_all('X-Launchpad-Bug-Private')
158- mark@example.com ['no']
159+ test@canonical.com ['no']
160
161 Predictably, private bugs are sent with a slightly different header:
162
163@@ -780,7 +778,7 @@
164
165 >>> for message in trigger_and_get_email_messages(bug_three):
166 ... print message['To'], message.get_all('X-Launchpad-Bug-Private')
167- mark@example.com ['yes']
168+ test@canonical.com ['yes']
169
170
171 The X-Launchpad-Bug-Security-Vulnerability header
172@@ -796,7 +794,7 @@
173 >>> for message in trigger_and_get_email_messages(bug_three):
174 ... print message['To'], (
175 ... message.get_all('X-Launchpad-Bug-Security-Vulnerability'))
176- mark@example.com ['no']
177+ test@canonical.com ['no']
178
179 The presence of the security flag on a bug is, surprise, denoted by a
180 simple "yes":
181@@ -809,7 +807,7 @@
182 >>> for message in trigger_and_get_email_messages(bug_three):
183 ... print message['To'], (
184 ... message.get_all('X-Launchpad-Bug-Security-Vulnerability'))
185- mark@example.com ['yes']
186+ test@canonical.com ['yes']
187
188
189 The X-Launchpad-Bug-Commenters header
190@@ -1238,7 +1236,7 @@
191 <BLANKLINE>
192 ** Summary changed to: whatever.
193 <BLANKLINE>
194- --
195+ --
196 You received this bug notification because you are subscribed to Mozilla
197 Firefox.
198 ...
199@@ -1287,7 +1285,7 @@
200 <BLANKLINE>
201 ** Summary changed to: something.
202 <BLANKLINE>
203- --
204+ --
205 You received this bug notification because you are a member of ShipIt
206 Administrators, which is a direct subscriber.
207 http://bugs.launchpad.dev/bugs/1
208
209=== modified file 'lib/lp/bugs/doc/bugzilla-import.txt'
210--- lib/lp/bugs/doc/bugzilla-import.txt 2010-10-18 22:24:59 +0000
211+++ lib/lp/bugs/doc/bugzilla-import.txt 2010-12-23 19:45:24 +0000
212@@ -363,7 +363,6 @@
213 Reporter: Sample Person
214 Created: 2005-04-04 00:00:00+00:00
215 Subscribers:
216- Mark Shuttleworth
217 Sample Person
218 Ubuntu Team
219 Task: Evolution
220@@ -540,5 +539,3 @@
221 True
222 >>> bug4.duplicateof == bug3
223 True
224-
225-
226
227=== modified file 'lib/lp/bugs/doc/initial-bug-contacts.txt'
228--- lib/lp/bugs/doc/initial-bug-contacts.txt 2010-10-18 22:24:59 +0000
229+++ lib/lp/bugs/doc/initial-bug-contacts.txt 2010-12-23 19:45:24 +0000
230@@ -348,7 +348,6 @@
231
232 >>> print '\n'.join(subscriber_names(bug_two_in_ubuntu.bug))
233 Foo Bar
234- Mark Shuttleworth
235 Sample Person
236 Steve Alexander
237 Ubuntu Team
238
239=== modified file 'lib/lp/bugs/model/bug.py'
240--- lib/lp/bugs/model/bug.py 2010-11-05 09:16:14 +0000
241+++ lib/lp/bugs/model/bug.py 2010-12-23 19:45:24 +0000
242@@ -988,10 +988,10 @@
243 # If the target's bug supervisor isn't set,
244 # we add the owner as a subscriber.
245 pillar = bugtask.pillar
246- if pillar.bug_supervisor is None:
247- also_notified_subscribers.add(pillar.owner)
248- if recipients is not None:
249- recipients.addRegistrant(pillar.owner, pillar)
250+ if pillar.bug_supervisor is None and pillar.official_malone:
251+ also_notified_subscribers.add(pillar.owner)
252+ if recipients is not None:
253+ recipients.addRegistrant(pillar.owner, pillar)
254
255 # Structural subscribers.
256 also_notified_subscribers.update(
257@@ -1790,8 +1790,12 @@
258
259 @cachedproperty
260 def _known_viewers(self):
261- """A dict of of known persons able to view this bug."""
262- return set()
263+ """A set of known persons able to view this bug.
264+
265+ Seed it by including the list of all owners of bugtasks for the bug.
266+ """
267+ bugtask_owners = [bt.pillar.owner.id for bt in self.bugtasks]
268+ return set(bugtask_owners)
269
270 def userCanView(self, user):
271 """See `IBug`.
272
273=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt'
274--- lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt 2010-10-19 14:55:46 +0000
275+++ lib/lp/bugs/stories/bugs/xx-bug-personal-subscriptions.txt 2010-12-23 19:45:24 +0000
276@@ -192,7 +192,6 @@
277 ... "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content")
278 >>> print_also_notified(stevea_browser.contents)
279 Also notified:
280- Mark Shuttleworth
281
282 But if bug #2, a bug that Steve is directly subscribed to, is marked as
283 a dupe of bug #3, then Steve gets indirectly subscribed to bug #3, and
284@@ -243,7 +242,6 @@
285 ... "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content")
286 >>> print_also_notified(stevea_browser.contents)
287 Also notified:
288- Mark Shuttleworth
289
290 Let's repeat this example, with Steve subscribed to two different dupes,
291 to see how the unsubscribe notification changes slightly, because he
292@@ -274,7 +272,6 @@
293 ... "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content")
294 >>> print_also_notified(stevea_browser.contents)
295 Also notified:
296- Mark Shuttleworth
297
298 >>> stevea_browser.open("http://launchpad.dev/bugs/3")
299 >>> stevea_browser.getLink("Unsubscribe").click()
300@@ -317,7 +314,6 @@
301
302 >>> print_also_notified(foobar_browser.contents)
303 Also notified:
304- Mark Shuttleworth
305
306 The subscribe link for Foo Bar still says "Subscribe", because
307 Foo Bar can subscribe himself directly to this bug. For unsubscribing
308@@ -350,7 +346,6 @@
309 ... "http://launchpad.dev/bugs/3/+bug-portlet-subscribers-content")
310 >>> print_also_notified(foobar_browser.contents)
311 Also notified:
312- Mark Shuttleworth
313
314
315 == Displaying subscribers ==
316
317=== modified file 'lib/lp/bugs/subscribers/bug.py'
318--- lib/lp/bugs/subscribers/bug.py 2010-10-25 13:22:46 +0000
319+++ lib/lp/bugs/subscribers/bug.py 2010-12-23 19:45:24 +0000
320@@ -187,7 +187,7 @@
321 # If the target's bug supervisor isn't set,
322 # we add the owner as a subscriber.
323 pillar = bugtask.pillar
324- if pillar.bug_supervisor is None:
325+ if pillar.bug_supervisor is None and pillar.official_malone:
326 also_notified_subscribers.add(pillar.owner)
327 if recipients is not None:
328 recipients.addRegistrant(pillar.owner, pillar)
329
330=== modified file 'lib/lp/bugs/tests/test_bugchanges.py'
331--- lib/lp/bugs/tests/test_bugchanges.py 2010-10-04 19:50:45 +0000
332+++ lib/lp/bugs/tests/test_bugchanges.py 2010-12-23 19:45:24 +0000
333@@ -932,7 +932,8 @@
334 new_target = self.factory.makeDistributionSourcePackage(
335 distribution=target.distribution)
336
337- source_package_bug = self.factory.makeBug(owner=self.user)
338+ source_package_bug = self.factory.makeBug(
339+ owner=self.user)
340 source_package_bug_task = source_package_bug.addTask(
341 owner=self.user, target=target)
342 self.saveOldChanges(source_package_bug)
343@@ -956,8 +957,8 @@
344 expected_recipients = [self.user, metadata_subscriber]
345 expected_recipients.extend(
346 bug_task.pillar.owner
347- for bug_task in source_package_bug.bugtasks)
348-
349+ for bug_task in source_package_bug.bugtasks
350+ if bug_task.pillar.official_malone)
351 expected_notification = {
352 'text': u"** Package changed: %s => %s" % (
353 bug_task_before_modification.bugtargetname,
354
355=== modified file 'lib/lp/bugs/tests/test_bugnotification.py'
356--- lib/lp/bugs/tests/test_bugnotification.py 2010-10-19 22:06:16 +0000
357+++ lib/lp/bugs/tests/test_bugnotification.py 2010-12-23 19:45:24 +0000
358@@ -9,6 +9,7 @@
359
360 from lazr.lifecycle.event import ObjectModifiedEvent
361 from lazr.lifecycle.snapshot import Snapshot
362+from testtools.matchers import Not
363 from zope.event import notify
364 from zope.interface import providedBy
365
366@@ -30,6 +31,7 @@
367 )
368 from lp.testing import TestCaseWithFactory
369 from lp.testing.factory import LaunchpadObjectFactory
370+from lp.testing.matchers import Contains
371 from lp.testing.mail_helpers import pop_notifications
372
373
374@@ -41,12 +43,16 @@
375 def setUp(self):
376 login('foo.bar@canonical.com')
377 factory = LaunchpadObjectFactory()
378- self.product = factory.makeProduct()
379- self.product_subscriber = factory.makePerson()
380+ self.product_owner = factory.makePerson(name="product-owner")
381+ self.product = factory.makeProduct(owner=self.product_owner)
382+ self.product_subscriber = factory.makePerson(
383+ name="product-subscriber")
384 self.product.addBugSubscription(
385 self.product_subscriber, self.product_subscriber)
386- self.bug_subscriber = factory.makePerson()
387- self.private_bug = factory.makeBug(product=self.product, private=True)
388+ self.bug_subscriber = factory.makePerson(name="bug-subscriber")
389+ self.bug_owner = factory.makePerson(name="bug-owner")
390+ self.private_bug = factory.makeBug(
391+ product=self.product, private=True, owner=self.bug_owner)
392 self.reporter = self.private_bug.owner
393 self.private_bug.subscribe(self.bug_subscriber, self.reporter)
394 [self.product_bugtask] = self.private_bug.bugtasks
395@@ -66,7 +72,7 @@
396 notified_people = set(
397 recipient.person.name
398 for recipient in latest_notification.recipients)
399- self.assertEqual(notified_people, self.direct_subscribers)
400+ self.assertEqual(self.direct_subscribers, notified_people)
401
402 def test_add_comment(self):
403 # Comment additions are sent to the direct subscribers only.
404@@ -76,7 +82,7 @@
405 notified_people = set(
406 recipient.person.name
407 for recipient in latest_notification.recipients)
408- self.assertEqual(notified_people, self.direct_subscribers)
409+ self.assertEqual(self.direct_subscribers, notified_people)
410
411 def test_bug_edit(self):
412 # Bug edits are sent to direct the subscribers only.
413@@ -90,7 +96,7 @@
414 notified_people = set(
415 recipient.person.name
416 for recipient in latest_notification.recipients)
417- self.assertEqual(notified_people, self.direct_subscribers)
418+ self.assertEqual(self.direct_subscribers, notified_people)
419
420
421 class TestNotificationsSentForBugExpiration(TestCaseWithFactory):
422@@ -206,3 +212,104 @@
423 recipient.person
424 for recipient in latest_notification.recipients)
425 self.assertEqual(self.dupe_subscribers, recipients)
426+
427+
428+class NotificationForRegistrantsMixin:
429+ """Mixin for testing when registrants get notified."""
430+
431+ layer = DatabaseFunctionalLayer
432+
433+ def setUp(self):
434+ super(NotificationForRegistrantsMixin, self).setUp(
435+ user='foo.bar@canonical.com')
436+ self.pillar_owner = self.factory.makePerson(name="distro-owner")
437+ self.bug_owner = self.factory.makePerson(name="bug-owner")
438+ self.pillar = self.makePillar()
439+ self.bug = self.makeBug()
440+
441+ def test_notification_uses_malone(self):
442+ self.pillar.official_malone = True
443+ direct = self.bug.getDirectSubscribers()
444+ indirect = self.bug.getIndirectSubscribers()
445+ self.assertThat(direct, Not(Contains(self.pillar_owner)))
446+ self.assertThat(indirect, Contains(self.pillar_owner))
447+
448+ def test_notification_does_not_use_malone(self):
449+ self.pillar.official_malone = False
450+ direct = self.bug.getDirectSubscribers()
451+ indirect = self.bug.getIndirectSubscribers()
452+ self.assertThat(direct, Not(Contains(self.pillar_owner)))
453+ self.assertThat(indirect, Not(Contains(self.pillar_owner)))
454+
455+ def test_status_change_uses_malone(self):
456+ # Status changes are sent to the direct and indirect subscribers.
457+ self.pillar.official_malone = True
458+ [bugtask] = self.bug.bugtasks
459+ all_subscribers = set(
460+ [person.name for person in
461+ self.bug.getDirectSubscribers() +
462+ self.bug.getIndirectSubscribers()])
463+ bugtask_before_modification = Snapshot(
464+ bugtask, providing=providedBy(bugtask))
465+ bugtask.transitionToStatus(
466+ BugTaskStatus.INVALID, self.bug.owner)
467+ notify(ObjectModifiedEvent(
468+ bugtask, bugtask_before_modification, ['status'],
469+ user=self.bug.owner))
470+ latest_notification = BugNotification.selectFirst(orderBy='-id')
471+ notified_people = set(
472+ recipient.person.name
473+ for recipient in latest_notification.recipients)
474+ self.assertEqual(all_subscribers, notified_people)
475+ self.assertThat(all_subscribers, Contains(self.pillar_owner.name))
476+
477+ def test_status_change_does_not_use_malone(self):
478+ # Status changes are sent to the direct and indirect subscribers.
479+ self.pillar.official_malone = False
480+ [bugtask] = self.bug.bugtasks
481+ all_subscribers = set(
482+ [person.name for person in
483+ self.bug.getDirectSubscribers() +
484+ self.bug.getIndirectSubscribers()])
485+ bugtask_before_modification = Snapshot(
486+ bugtask, providing=providedBy(bugtask))
487+ bugtask.transitionToStatus(
488+ BugTaskStatus.INVALID, self.bug.owner)
489+ notify(ObjectModifiedEvent(
490+ bugtask, bugtask_before_modification, ['status'],
491+ user=self.bug.owner))
492+ latest_notification = BugNotification.selectFirst(orderBy='-id')
493+ notified_people = set(
494+ recipient.person.name
495+ for recipient in latest_notification.recipients)
496+ self.assertEqual(all_subscribers, notified_people)
497+ self.assertThat(
498+ all_subscribers, Not(Contains(self.pillar_owner.name)))
499+
500+
501+class TestNotificationsForRegistrantsForDistros(
502+ NotificationForRegistrantsMixin, TestCaseWithFactory):
503+ """Test when distribution registrants get notified."""
504+
505+ def makePillar(self):
506+ return self.factory.makeDistribution(
507+ owner=self.pillar_owner)
508+
509+ def makeBug(self):
510+ return self.factory.makeBug(
511+ distribution=self.pillar,
512+ owner=self.bug_owner)
513+
514+
515+class TestNotificationsForRegistrantsForProducts(
516+ NotificationForRegistrantsMixin, TestCaseWithFactory):
517+ """Test when product registrants get notified."""
518+
519+ def makePillar(self):
520+ return self.factory.makeProduct(
521+ owner=self.pillar_owner)
522+
523+ def makeBug(self):
524+ return self.factory.makeBug(
525+ product=self.pillar,
526+ owner=self.bug_owner)
527
528=== modified file 'lib/lp/bugs/tests/test_bugs_webservice.py'
529--- lib/lp/bugs/tests/test_bugs_webservice.py 2010-10-04 19:50:45 +0000
530+++ lib/lp/bugs/tests/test_bugs_webservice.py 2010-12-23 19:45:24 +0000
531@@ -166,18 +166,18 @@
532 collector.register()
533 self.addCleanup(collector.unregister)
534 url = '/bugs/%d/attachments?ws.size=75' % self.bug.id
535- #First request
536+ # First request.
537 store.flush()
538 store.reset()
539 response = webservice.get(url)
540- self.assertThat(collector, HasQueryCount(LessThan(21)))
541+ self.assertThat(collector, HasQueryCount(LessThan(22)))
542 with_2_count = collector.count
543 self.failUnlessEqual(response.status, 200)
544 login(USER_EMAIL)
545 for i in range(5):
546 self.factory.makeBugAttachment(self.bug)
547 logout()
548- #Second request
549+ # Second request.
550 store.flush()
551 store.reset()
552 response = webservice.get(url)
553@@ -202,11 +202,11 @@
554 collector.register()
555 self.addCleanup(collector.unregister)
556 url = '/bugs/%d/messages?ws.size=75' % bug.id
557- #First request
558+ # First request.
559 store.flush()
560 store.reset()
561 response = webservice.get(url)
562- self.assertThat(collector, HasQueryCount(LessThan(21)))
563+ self.assertThat(collector, HasQueryCount(LessThan(22)))
564 with_2_count = collector.count
565 self.failUnlessEqual(response.status, 200)
566 login(USER_EMAIL)
567@@ -214,7 +214,7 @@
568 self.factory.makeBugComment(bug)
569 self.factory.makeBugAttachment(bug)
570 logout()
571- #Second request
572+ # Second request.
573 store.flush()
574 store.reset()
575 response = webservice.get(url)
576
577=== modified file 'lib/lp/bugs/tests/test_bugtask_search.py'
578--- lib/lp/bugs/tests/test_bugtask_search.py 2010-12-14 02:18:32 +0000
579+++ lib/lp/bugs/tests/test_bugtask_search.py 2010-12-23 19:45:24 +0000
580@@ -91,7 +91,8 @@
581 # search result.
582 user = self.factory.makePerson()
583 with person_logged_in(self.owner):
584- self.bugtasks[-1].bug.subscribe(user, self.owner)
585+ bug = self.bugtasks[-1].bug
586+ bug.subscribe(user, self.owner)
587 params = self.getBugTaskSearchParams(user=user)
588 self.assertSearchFinds(params, self.bugtasks)
589