Merge lp:~gmb/launchpad/retry-rofo-watches-bug-566600 into lp:launchpad

Proposed by Graham Binns on 2010-05-13
Status: Merged
Approved by: Graham Binns on 2010-05-14
Approved revision: no longer in the source branch.
Merged at revision: 10864
Proposed branch: lp:~gmb/launchpad/retry-rofo-watches-bug-566600
Merge into: lp:launchpad
Diff against target: 45 lines (+27/-0)
2 files modified
lib/lp/bugs/model/bugwatch.py (+5/-0)
lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt (+22/-0)
To merge this branch: bzr merge lp:~gmb/launchpad/retry-rofo-watches-bug-566600
Reviewer Review Type Date Requested Status
Michael Nelson (community) code 2010-05-13 Approve on 2010-05-13
Review via email: mp+25225@code.launchpad.net

Commit Message

The "Update now" button will appear for bug watches which have run and failed once (previously the button would not have appeared for these watches).

Description of the Change

This branch fixes bug 566600 by making BugWatch.can_be_rescheduled return true if the watch has been updated once and failed to update.

To post a comment you must log in.
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/bugs/model/bugwatch.py'
2--- lib/lp/bugs/model/bugwatch.py 2010-04-30 03:10:17 +0000
3+++ lib/lp/bugs/model/bugwatch.py 2010-05-13 12:05:43 +0000
4@@ -350,6 +350,11 @@
5 # failed.
6 return False
7
8+ if self.failed_activity.count() == 1 and self.activity.count() == 1:
9+ # In cases where a watch has been updated once and failed,
10+ # we allow the user to reschedule it.
11+ return True
12+
13 # If the ratio is lower than the reschedule threshold, we
14 # can show the button.
15 failure_ratio = (
16
17=== modified file 'lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt'
18--- lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt 2010-04-19 15:24:41 +0000
19+++ lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt 2010-05-13 12:05:43 +0000
20@@ -200,3 +200,25 @@
21 ...
22 LookupError: label 'Update Now'
23
24+If a watch has run once and failed once, the reschedule button will be
25+shown.
26+
27+ >>> from pytz import utc
28+ >>> from datetime import datetime, timedelta
29+ >>> login('foo.bar@canonical.com')
30+ >>> bug_watch = factory.makeBugWatch()
31+ >>> bug_watch.next_check = None
32+ >>> bug_watch.addActivity(result=BugWatchActivityStatus.BUG_NOT_FOUND)
33+ >>> watch_url = (
34+ ... 'http://bugs.launchpad.dev/bugs/%s/+watch/%s' %
35+ ... (bug_watch.bug.id, bug_watch.id))
36+ >>> logout()
37+
38+ >>> user_browser.open(watch_url)
39+ >>> reschedule_button = user_browser.getControl('Update Now')
40+ >>> reschedule_button.click()
41+
42+ >>> for message in find_tags_by_class(
43+ ... user_browser.contents, 'informational message'):
44+ ... print extract_text(message)
45+ The ... bug watch has been scheduled for immediate checking.