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
=== modified file 'lib/lp/registry/stories/person/xx-person-subscriptions.txt'
--- lib/lp/registry/stories/person/xx-person-subscriptions.txt 2010-10-07 22:25:24 +0000
+++ lib/lp/registry/stories/person/xx-person-subscriptions.txt 2010-10-13 18:48:55 +0000
@@ -18,114 +18,129 @@
18 >>> "does not have any direct bug subscriptions" in page_text18 >>> "does not have any direct bug subscriptions" in page_text
19 True19 True
2020
21Any user can see that Sample Person is subscribed to several bugs. The bug21To test bug subscriptions we are going to create two products, Affluenza and
22subscriptions table includes the bug number, title and location.22Scofflaw, and a user Webster who will be subscribed to bugs about both of
2323those.
24 >>> anon_browser.open('http://launchpad.dev/~name12/+subscriptions')24
25 >>> login('foo.bar@canonical.com')
26 >>> scofflaw = factory.makeProduct(name='scofflaw')
27 >>> bugA = factory.makeBug(product=scofflaw,
28 ... title='Word needs more popularity')
29 >>> affluenza = factory.makeProduct(name='affluenza')
30 >>> bugB = factory.makeBug(product=affluenza,
31 ... title='A terrible affliction')
32 >>> subscriber = factory.makePerson(name='webster',
33 ... password='g00dpassword')
34 >>> subscriptionA = bugA.subscribe(subscriber, subscriber)
35 >>> subscriptionB = bugB.subscribe(subscriber, subscriber)
36 >>> logout()
37
38Any user can see Webster's bug subscriptions. The bug subscriptions table
39includes the bug number, title and location.
40
41 >>> anon_browser.open('http://launchpad.dev/~webster/+subscriptions')
25 >>> print extract_text(find_tag_by_id(42 >>> print extract_text(find_tag_by_id(
26 ... anon_browser.contents, 'bug_subscriptions'))43 ... anon_browser.contents, 'bug_subscriptions'))
27 Summary44 Summary
28 In45 In
29 1346 ...
30 Launchpad CSS and JS is not testible47 Word needs more popularity
31 Launchpad48 Scofflaw
32 449 ...
33 Reflow problems with complex page layouts50 A terrible affliction
34 Mozilla Firefox51 Affluenza
35 9
36 Thunderbird crashes
37 thunderbird (Ubuntu)
38 1
39 Firefox does not support SVG
40 Mozilla Firefox
4152
42The bug subscriptions table also includes an unsubscribe link, if they have53The bug subscriptions table also includes an unsubscribe link, if the user has
43permission to remove the subscription, for bugs to which the person or team is54permission to remove the subscription, for bugs to which the person or team is
44subscribed.55subscribed.
4556
46Sample Person can see and manage his direct bug subscriptions using the page57Webster can see and manage his direct bug subscriptions using the page too.
47too. He chooses to view bug 13 - "Launchpad CSS and JS in not testible".58He chooses to view the bug about Scofflaw.
4859
49 >>> sample_browser = setupBrowser(auth='Basic test@canonical.com:test')60 >>> login('foo.bar@canonical.com')
50 >>> sample_browser.open('http://bugs.launchpad.dev/~name12/+subscriptions')61 >>> subscriber_browser = setupBrowser(
51 >>> unsub_link = sample_browser.getLink(62 ... auth='Basic %s:g00dpassword' %
52 ... id='unsubscribe-subscriber-12')63 ... subscriber.preferredemail.email)
64 >>> logout()
65 >>> subscriber_browser.open('http://bugs.launchpad.dev/~webster/+subscriptions')
66 >>> unsub_link = subscriber_browser.getLink(
67 ... id='unsubscribe-subscriber-%s' % subscriber.id)
53 >>> unsub_link.click()68 >>> unsub_link.click()
54 >>> print extract_text(find_tag_by_id(69 >>> page_text = extract_text(find_tag_by_id(
55 ... sample_browser.contents, 'nonportlets'))70 ... subscriber_browser.contents, 'nonportlets'))
56 Unsubscribe from bug #1371 >>> "Unsubscribe me from this bug" in page_text
57 ...72 True
5873
59After viewing the +subscribe page Sample Person decides that they still want74After viewing the +subscribe page Webster decides that he still wants to be
60to be subscribed to bug 13. They click cancel which takes them back to their75subscribed to the bug. He clicks cancel which takes him back to his
61+subscription page.76+subscription page.
6277
63 >>> cancel_link = sample_browser.getLink('Cancel')78 >>> cancel_link = subscriber_browser.getLink('Cancel')
64 >>> cancel_link.click()79 >>> cancel_link.click()
65 >>> print sample_browser.title80 >>> print subscriber_browser.title
66 Subscriptions : Sample Person81 Subscriptions : Webster
6782
68He chooses to unsubscribe from bug 9 - "Thunderbird crashes".83He chooses to unsubscribe from the bug about Affluenza.
6984
70 >>> sample_browser.getLink(url='/ubuntu/+source/thunderbird/+bug/9/+subscribe').click()85 >>> subscriber_browser.getLink(url='/affluenza/+bug/%s/+subscribe'
71 >>> sample_browser.getControl("Unsubscribe me from this bug").selected = True86 ... % bugB.id).click()
72 >>> sample_browser.getControl("Continue").click()87 >>> subscriber_browser.getControl("Unsubscribe me from this bug").selected = True
73 >>> print sample_browser.title88 >>> subscriber_browser.getControl("Continue").click()
74 Subscriptions : Sample Person89 >>> print subscriber_browser.title
7590 Subscriptions : Webster
76Sample Person can see that bug 9 is no longer listed in his direct bug91
77subscriptions.92Webster can see that the bug about Affluenza is no longer listed in his direct
7893bug subscriptions.
79 >>> sample_browser.open('http://bugs.launchpad.dev/~name12/+subscriptions')94
95 >>> subscriber_browser.open('http://bugs.launchpad.dev/~webster/+subscriptions')
80 >>> print extract_text(find_tag_by_id(96 >>> print extract_text(find_tag_by_id(
81 ... sample_browser.contents, 'bug_subscriptions'))97 ... subscriber_browser.contents, 'bug_subscriptions'))
82 Summary98 Summary
83 In99 In
84 13100 ...
85 Launchpad CSS and JS is not testible101 Word needs more popularity
86 Launchpad102 Scofflaw
87 4
88 Reflow problems with complex page layouts
89 Mozilla Firefox
90 1
91 Firefox does not support SVG
92 Mozilla Firefox
93103
94Sample Person adds a bug subscription for a team, HWDB team, of which he is a104Webster adds a bug subscription for a team, team America, of which he is a
95member.105member.
96106
97 >>> sample_browser.open('http://bugs.launchpad.dev/firefox/+bug/1/+addsubscriber')107 >>> login('foo.bar@canonical.com')
98 >>> sample_browser.getControl('Person').value = 'hwdb-team'108 >>> team = factory.makeTeam(name='america')
99 >>> sample_browser.getControl('Subscribe user').click()109 >>> bugC = factory.makeBug(product=scofflaw,
100110 ... title="Word came from a contest")
101Sample Person chooses to review the subscriptions for his HWDB team.111 >>> membership = team.addMember(subscriber, subscriber)
102112 >>> subscriptionC = bugC.subscribe(team, subscriber)
103 >>> sample_browser.open('https://bugs.launchpad.dev/~hwdb-team/+subscriptions')113 >>> logout()
104 >>> print sample_browser.title114
105 Subscriptions : “HWDB Team” team115Webster chooses to review the subscriptions for his team America.
116
117 >>> subscriber_browser.open('https://bugs.launchpad.dev/~america/+subscriptions')
118 >>> print subscriber_browser.title
119 Subscriptions : “America” team
106120
107 >>> print extract_text(find_tag_by_id(121 >>> print extract_text(find_tag_by_id(
108 ... sample_browser.contents, 'bug_subscriptions'))122 ... subscriber_browser.contents, 'bug_subscriptions'))
109 Summary123 Summary
110 In124 In
111 1
112 Firefox does not support SVG
113 Mozilla Firefox
114
115Sample Person now chooses to unsubscribe HWDB team from bug 1.
116
117 >>> sample_browser.getLink(id='unsubscribe-subscriber-243630').click()
118 >>> print extract_text(find_tag_by_id(
119 ... sample_browser.contents, 'nonportlets'))
120 Unsubscribe from bug #1
121 ...125 ...
122126 Word came from a contest
123 >>> sample_browser.getControl(127 Scofflaw
124 ... 'Unsubscribe HWDB Team from this bug').selected = True128
125 >>> sample_browser.getControl('Continue').click()129Webster now chooses to unsubscribe team America from the bug about Scofflaw.
126130
127 >>> sample_browser.open('https://launchpad.dev/~hwdb-team/+subscriptions')131 >>> subscriber_browser.getLink(id='unsubscribe-subscriber-%s' %
132 ... team.id).click()
133 >>> print extract_text(find_tags_by_class(
134 ... subscriber_browser.contents, 'value')[0])
135 Subscribe me to this bug
136 Unsubscribe America from this bug
137
138 >>> subscriber_browser.getControl(
139 ... 'Unsubscribe America from this bug').selected = True
140 >>> subscriber_browser.getControl('Continue').click()
141
142 >>> subscriber_browser.open('https://launchpad.dev/~america/+subscriptions')
128 >>> page_text = extract_text(143 >>> page_text = extract_text(
129 ... find_main_content(sample_browser.contents))144 ... find_main_content(subscriber_browser.contents))
130 >>> "does not have any direct bug subscriptions" in page_text145 >>> "does not have any direct bug subscriptions" in page_text
131 True146 True