Merge lp:~brian-murray/launchpad/person-subscription-story into lp:launchpad

Proposed by Brian Murray
Status: Merged
Approved by: Brian Murray
Approved revision: no longer in the source branch.
Merged at revision: 11699
Proposed branch: lp:~brian-murray/launchpad/person-subscription-story
Merge into: lp:launchpad
Diff against target: 216 lines (+98/-83)
1 file modified
lib/lp/registry/stories/person/xx-person-subscriptions.txt (+98/-83)
To merge this branch: bzr merge lp:~brian-murray/launchpad/person-subscription-story
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Approve
Review via email: mp+37920@code.launchpad.net

Commit message

Modify xx-person-subscriptions.txt not to use sample data.

Description of the change

I rewrote this test not to use or rely on sample data.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Its good that you've done that but, the '16' and '17' literals are
still dependent on sample data.

If you make this into a pyunit test rather than a doctest, it will
actually be free of sample data dependencies.
(or use ..., but thats potentially risky).

-Rob

Revision history for this message
Leonard Richardson (leonardr) wrote :

You mention Webster in the text before creating that person. To avoid confusion, the first mention of Webster should be something like "We're going to create a person called Webster... Any user can see..."

You mention bug #16 in the test text but you never mention it as a code literal, so you can remove it from the text.

You still mention bug 17 as a code literal, as well as the subscriber id 243656. Can you do better?

In a big code branch I'd consider these changes on the level of "approve with changes". But since the point of this branch is to improve the test, I'm marking this 'needs fixing'

review: Needs Fixing
Revision history for this message
Brian Murray (brian-murray) wrote :

I've modified the branch based off your feedback - thanks!

Revision history for this message
Leonard Richardson (leonardr) wrote :

"Any user can see that Webster is subscribed to some bugs. " => "Any user can see Webster's bug subscriptions." (Otherwise it reads like "As even a dummy can see, Webster is subscribed to some bugs.")

Sometimes Webster is "they" and sometimes "he". Pick a pronoun and stick with it.

Looks good otherwise.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/stories/person/xx-person-subscriptions.txt'
2--- lib/lp/registry/stories/person/xx-person-subscriptions.txt 2010-10-07 22:25:24 +0000
3+++ lib/lp/registry/stories/person/xx-person-subscriptions.txt 2010-10-13 18:48:55 +0000
4@@ -18,114 +18,129 @@
5 >>> "does not have any direct bug subscriptions" in page_text
6 True
7
8-Any user can see that Sample Person is subscribed to several bugs. The bug
9-subscriptions table includes the bug number, title and location.
10-
11- >>> anon_browser.open('http://launchpad.dev/~name12/+subscriptions')
12+To test bug subscriptions we are going to create two products, Affluenza and
13+Scofflaw, and a user Webster who will be subscribed to bugs about both of
14+those.
15+
16+ >>> login('foo.bar@canonical.com')
17+ >>> scofflaw = factory.makeProduct(name='scofflaw')
18+ >>> bugA = factory.makeBug(product=scofflaw,
19+ ... title='Word needs more popularity')
20+ >>> affluenza = factory.makeProduct(name='affluenza')
21+ >>> bugB = factory.makeBug(product=affluenza,
22+ ... title='A terrible affliction')
23+ >>> subscriber = factory.makePerson(name='webster',
24+ ... password='g00dpassword')
25+ >>> subscriptionA = bugA.subscribe(subscriber, subscriber)
26+ >>> subscriptionB = bugB.subscribe(subscriber, subscriber)
27+ >>> logout()
28+
29+Any user can see Webster's bug subscriptions. The bug subscriptions table
30+includes the bug number, title and location.
31+
32+ >>> anon_browser.open('http://launchpad.dev/~webster/+subscriptions')
33 >>> print extract_text(find_tag_by_id(
34 ... anon_browser.contents, 'bug_subscriptions'))
35 Summary
36 In
37- 13
38- Launchpad CSS and JS is not testible
39- Launchpad
40- 4
41- Reflow problems with complex page layouts
42- Mozilla Firefox
43- 9
44- Thunderbird crashes
45- thunderbird (Ubuntu)
46- 1
47- Firefox does not support SVG
48- Mozilla Firefox
49+ ...
50+ Word needs more popularity
51+ Scofflaw
52+ ...
53+ A terrible affliction
54+ Affluenza
55
56-The bug subscriptions table also includes an unsubscribe link, if they have
57+The bug subscriptions table also includes an unsubscribe link, if the user has
58 permission to remove the subscription, for bugs to which the person or team is
59 subscribed.
60
61-Sample Person can see and manage his direct bug subscriptions using the page
62-too. He chooses to view bug 13 - "Launchpad CSS and JS in not testible".
63+Webster can see and manage his direct bug subscriptions using the page too.
64+He chooses to view the bug about Scofflaw.
65
66- >>> sample_browser = setupBrowser(auth='Basic test@canonical.com:test')
67- >>> sample_browser.open('http://bugs.launchpad.dev/~name12/+subscriptions')
68- >>> unsub_link = sample_browser.getLink(
69- ... id='unsubscribe-subscriber-12')
70+ >>> login('foo.bar@canonical.com')
71+ >>> subscriber_browser = setupBrowser(
72+ ... auth='Basic %s:g00dpassword' %
73+ ... subscriber.preferredemail.email)
74+ >>> logout()
75+ >>> subscriber_browser.open('http://bugs.launchpad.dev/~webster/+subscriptions')
76+ >>> unsub_link = subscriber_browser.getLink(
77+ ... id='unsubscribe-subscriber-%s' % subscriber.id)
78 >>> unsub_link.click()
79- >>> print extract_text(find_tag_by_id(
80- ... sample_browser.contents, 'nonportlets'))
81- Unsubscribe from bug #13
82- ...
83+ >>> page_text = extract_text(find_tag_by_id(
84+ ... subscriber_browser.contents, 'nonportlets'))
85+ >>> "Unsubscribe me from this bug" in page_text
86+ True
87
88-After viewing the +subscribe page Sample Person decides that they still want
89-to be subscribed to bug 13. They click cancel which takes them back to their
90+After viewing the +subscribe page Webster decides that he still wants to be
91+subscribed to the bug. He clicks cancel which takes him back to his
92 +subscription page.
93
94- >>> cancel_link = sample_browser.getLink('Cancel')
95+ >>> cancel_link = subscriber_browser.getLink('Cancel')
96 >>> cancel_link.click()
97- >>> print sample_browser.title
98- Subscriptions : Sample Person
99-
100-He chooses to unsubscribe from bug 9 - "Thunderbird crashes".
101-
102- >>> sample_browser.getLink(url='/ubuntu/+source/thunderbird/+bug/9/+subscribe').click()
103- >>> sample_browser.getControl("Unsubscribe me from this bug").selected = True
104- >>> sample_browser.getControl("Continue").click()
105- >>> print sample_browser.title
106- Subscriptions : Sample Person
107-
108-Sample Person can see that bug 9 is no longer listed in his direct bug
109-subscriptions.
110-
111- >>> sample_browser.open('http://bugs.launchpad.dev/~name12/+subscriptions')
112+ >>> print subscriber_browser.title
113+ Subscriptions : Webster
114+
115+He chooses to unsubscribe from the bug about Affluenza.
116+
117+ >>> subscriber_browser.getLink(url='/affluenza/+bug/%s/+subscribe'
118+ ... % bugB.id).click()
119+ >>> subscriber_browser.getControl("Unsubscribe me from this bug").selected = True
120+ >>> subscriber_browser.getControl("Continue").click()
121+ >>> print subscriber_browser.title
122+ Subscriptions : Webster
123+
124+Webster can see that the bug about Affluenza is no longer listed in his direct
125+bug subscriptions.
126+
127+ >>> subscriber_browser.open('http://bugs.launchpad.dev/~webster/+subscriptions')
128 >>> print extract_text(find_tag_by_id(
129- ... sample_browser.contents, 'bug_subscriptions'))
130+ ... subscriber_browser.contents, 'bug_subscriptions'))
131 Summary
132 In
133- 13
134- Launchpad CSS and JS is not testible
135- Launchpad
136- 4
137- Reflow problems with complex page layouts
138- Mozilla Firefox
139- 1
140- Firefox does not support SVG
141- Mozilla Firefox
142+ ...
143+ Word needs more popularity
144+ Scofflaw
145
146-Sample Person adds a bug subscription for a team, HWDB team, of which he is a
147+Webster adds a bug subscription for a team, team America, of which he is a
148 member.
149
150- >>> sample_browser.open('http://bugs.launchpad.dev/firefox/+bug/1/+addsubscriber')
151- >>> sample_browser.getControl('Person').value = 'hwdb-team'
152- >>> sample_browser.getControl('Subscribe user').click()
153-
154-Sample Person chooses to review the subscriptions for his HWDB team.
155-
156- >>> sample_browser.open('https://bugs.launchpad.dev/~hwdb-team/+subscriptions')
157- >>> print sample_browser.title
158- Subscriptions : “HWDB Team” team
159+ >>> login('foo.bar@canonical.com')
160+ >>> team = factory.makeTeam(name='america')
161+ >>> bugC = factory.makeBug(product=scofflaw,
162+ ... title="Word came from a contest")
163+ >>> membership = team.addMember(subscriber, subscriber)
164+ >>> subscriptionC = bugC.subscribe(team, subscriber)
165+ >>> logout()
166+
167+Webster chooses to review the subscriptions for his team America.
168+
169+ >>> subscriber_browser.open('https://bugs.launchpad.dev/~america/+subscriptions')
170+ >>> print subscriber_browser.title
171+ Subscriptions : “America” team
172
173 >>> print extract_text(find_tag_by_id(
174- ... sample_browser.contents, 'bug_subscriptions'))
175+ ... subscriber_browser.contents, 'bug_subscriptions'))
176 Summary
177 In
178- 1
179- Firefox does not support SVG
180- Mozilla Firefox
181-
182-Sample Person now chooses to unsubscribe HWDB team from bug 1.
183-
184- >>> sample_browser.getLink(id='unsubscribe-subscriber-243630').click()
185- >>> print extract_text(find_tag_by_id(
186- ... sample_browser.contents, 'nonportlets'))
187- Unsubscribe from bug #1
188 ...
189-
190- >>> sample_browser.getControl(
191- ... 'Unsubscribe HWDB Team from this bug').selected = True
192- >>> sample_browser.getControl('Continue').click()
193-
194- >>> sample_browser.open('https://launchpad.dev/~hwdb-team/+subscriptions')
195+ Word came from a contest
196+ Scofflaw
197+
198+Webster now chooses to unsubscribe team America from the bug about Scofflaw.
199+
200+ >>> subscriber_browser.getLink(id='unsubscribe-subscriber-%s' %
201+ ... team.id).click()
202+ >>> print extract_text(find_tags_by_class(
203+ ... subscriber_browser.contents, 'value')[0])
204+ Subscribe me to this bug
205+ Unsubscribe America from this bug
206+
207+ >>> subscriber_browser.getControl(
208+ ... 'Unsubscribe America from this bug').selected = True
209+ >>> subscriber_browser.getControl('Continue').click()
210+
211+ >>> subscriber_browser.open('https://launchpad.dev/~america/+subscriptions')
212 >>> page_text = extract_text(
213- ... find_main_content(sample_browser.contents))
214+ ... find_main_content(subscriber_browser.contents))
215 >>> "does not have any direct bug subscriptions" in page_text
216 True