Merge lp:~adeuring/launchpad/bug-596944-browser into lp:launchpad/db-devel

Proposed by Abel Deuring on 2010-12-02
Status: Merged
Approved by: Abel Deuring on 2010-12-02
Approved revision: no longer in the source branch.
Merged at revision: 10033
Proposed branch: lp:~adeuring/launchpad/bug-596944-browser
Merge into: lp:launchpad/db-devel
Diff against target: 373 lines (+155/-93)
7 files modified
lib/lp/bugs/browser/bugtarget.py (+9/-6)
lib/lp/bugs/browser/tests/test_bugtarget_configure.py (+6/-2)
lib/lp/bugs/browser/tests/test_bugtarget_filebug.py (+37/-0)
lib/lp/bugs/interfaces/bugtarget.py (+7/-0)
lib/lp/bugs/templates/bugtarget-filebug-search.pt (+92/-83)
lib/lp/registry/browser/distributionsourcepackage.py (+2/-1)
lib/lp/registry/browser/tests/distributionsourcepackage-views.txt (+2/-1)
To merge this branch: bzr merge lp:~adeuring/launchpad/bug-596944-browser
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code 2010-12-02 Approve on 2010-12-02
Abel Deuring (community) Resubmit on 2010-12-02
j.c.sackett (community) code* 2010-12-02 Approve on 2010-12-02
Review via email: mp+42505@code.launchpad.net

Commit Message

[r=jcsackett,sinzui][ui=none][bug=596944] The forms to configure the bugtracker for products and for DSPs now contains a field enable_bugfiling_duplicate_search; bug filing pages show immediately the complete form if enable_bugfiling_duplicate_search is turned off.

Description of the Change

This branch adds a field to enable/disable duplicate searches to the bug tracker configuration forms for distribution source packages and for products.

The template for filing bugs now renders the "main bug report form" immediately if the duplicate search is disabled.

I talked with Deryck about writing unit tests for the changes, but we think it is better toland the branch before PQM closes tomorrow, so I simply extended an existing page test instead.

test: ./bin/test -vvt xx-product-guided-filebug.txt

no lint, excpet complaints about Moin headers in the page test

To post a comment you must log in.
j.c.sackett (jcsackett) wrote :

Abel--

This looks like a nice branch.

I would really appreciate it if you could clean up the moin headers to restructured text, since that's the direction we seem to be heading in docs/stories.

Also: this may be just prejudice on my part, but it might be worth getting an RC for this branch and building out the unittests for this. Not a blocker for the branch, but an idea.

Aside from that, thanks for cleaning up some formatting and link text while you were at it.

review: Approve (code*)
Curtis Hovey (sinzui) wrote :

The additions to the story test are not a story. If I remove the code, the text does not make sense. If I just read the code in the story, I do not know why an admin is making the change for a project he does not own (either the owner does not have permission or we are masking permission issues--do not use admin when unless only an admin can do the task). Users do not read URLs, they read browser title and page content. I personally cannot see how the change is being tests. I do not think a slow story is needed for these changes.

The change was to a view and I expect TestProductBugConfigurationView to be updated to verify the field is present and mutable by the project owner or bug supervisor. I think you could test for html ids to verify the correct template chunks were rendered
    self.assertIsNot(None, find_tag_by_id(view.render(), 'an-id'))

review: Needs Fixing (code)
Abel Deuring (adeuring) wrote :

I've added unit tests for both variants of the bug reporting form and changed an existing test for the edit form.

review: Resubmit
Curtis Hovey (sinzui) wrote :

Your test additions are lovely.

Remove the previous additions to lib/lp/bugs/stories/guided-filebug/xx-product-guided-filebug.txt. We want to test something once and test it very well. The story additions do not document what the user is trying to accomplish, they are slow to execute, and could contradict the definitive tests when subsequent changes are made.

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/browser/bugtarget.py'
2--- lib/lp/bugs/browser/bugtarget.py 2010-11-25 10:18:51 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2010-12-03 09:00:42 +0000
4@@ -163,6 +163,8 @@
5 IBugTarget['bug_reporting_guidelines'])
6 bug_reported_acknowledgement = copy_field(
7 IBugTarget['bug_reported_acknowledgement'])
8+ enable_bugfiling_duplicate_search = copy_field(
9+ IBugTarget['enable_bugfiling_duplicate_search'])
10
11
12 def product_to_productbugconfiguration(product):
13@@ -187,12 +189,13 @@
14 def field_names(self):
15 """Return the list of field names to display."""
16 field_names = [
17- "bugtracker",
18- "enable_bug_expiration",
19- "remote_product",
20- "bug_reporting_guidelines",
21- "bug_reported_acknowledgement",
22- ]
23+ "bugtracker",
24+ "enable_bug_expiration",
25+ "remote_product",
26+ "bug_reporting_guidelines",
27+ "bug_reported_acknowledgement",
28+ "enable_bugfiling_duplicate_search",
29+ ]
30 if check_permission("launchpad.Edit", self.context):
31 field_names.extend(["bug_supervisor", "security_contact"])
32
33
34=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_configure.py'
35--- lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-11-02 21:38:30 +0000
36+++ lib/lp/bugs/browser/tests/test_bugtarget_configure.py 2010-12-03 09:00:42 +0000
37@@ -38,6 +38,7 @@
38 'field.remote_product': 'sf-boing',
39 'field.bug_reporting_guidelines': 'guidelines',
40 'field.bug_reported_acknowledgement': 'acknowledgement message',
41+ 'field.enable_bugfiling_duplicate_search': False,
42 'field.actions.change': 'Change',
43 }
44
45@@ -49,7 +50,8 @@
46 fields = [
47 'bugtracker', 'enable_bug_expiration', 'remote_product',
48 'bug_reporting_guidelines', 'bug_reported_acknowledgement',
49- 'bug_supervisor', 'security_contact']
50+ 'enable_bugfiling_duplicate_search', 'bug_supervisor',
51+ 'security_contact']
52 self.assertEqual(fields, view.field_names)
53 self.assertEqual('http://launchpad.dev/boing', view.next_url)
54 self.assertEqual('http://launchpad.dev/boing', view.cancel_url)
55@@ -63,7 +65,8 @@
56 self.assertEqual(label, view.label)
57 fields = [
58 'bugtracker', 'enable_bug_expiration', 'remote_product',
59- 'bug_reporting_guidelines', 'bug_reported_acknowledgement']
60+ 'bug_reporting_guidelines', 'bug_reported_acknowledgement',
61+ 'enable_bugfiling_duplicate_search']
62 self.assertEqual(fields, view.field_names)
63 self.assertEqual('http://launchpad.dev/boing', view.next_url)
64 self.assertEqual('http://launchpad.dev/boing', view.cancel_url)
65@@ -87,6 +90,7 @@
66 self.assertEqual(
67 'acknowledgement message',
68 self.product.bug_reported_acknowledgement)
69+ self.assertFalse(self.product.enable_bugfiling_duplicate_search)
70
71 def test_bug_supervisor_invalid(self):
72 # Verify that invalid bug_supervisor states are reported.
73
74=== modified file 'lib/lp/bugs/browser/tests/test_bugtarget_filebug.py'
75--- lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2010-10-04 19:50:45 +0000
76+++ lib/lp/bugs/browser/tests/test_bugtarget_filebug.py 2010-12-03 09:00:42 +0000
77@@ -7,6 +7,7 @@
78 import unittest
79
80 from canonical.launchpad.ftests import login
81+from canonical.launchpad.testing.pages import find_tag_by_id
82 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
83 from canonical.testing.layers import LaunchpadFunctionalLayer
84 from lp.bugs.browser.bugtarget import FileBugInlineFormView
85@@ -257,6 +258,42 @@
86 [notification.message
87 for notification in view.request.response.notifications])
88
89+ def test_bug_filing_view_with_dupe_search_enabled(self):
90+ # When a user files a bug for a product where searching for
91+ # duplicate bugs is enabled, he is asked to provide a
92+ # summary of the bug. This summary is used to find possible
93+ # existing duplicates f this bug.
94+ product = self.factory.makeProduct()
95+ login_person(product.owner)
96+ product.official_malone = True
97+ product.enable_bugfiling_duplicate_search = True
98+ user = self.factory.makePerson()
99+ login_person(user)
100+ view = create_initialized_view(
101+ product, name='+filebug', principal=user)
102+ html = view.render()
103+ self.assertIsNot(None, find_tag_by_id(html, 'filebug-search-form'))
104+ # The main bug filing form is not shown.
105+ self.assertIs(None, find_tag_by_id(html, 'filebug-form'))
106+
107+ def test_bug_filing_view_with_dupe_search_disabled(self):
108+ # When a user files a bug for a product where searching for
109+ # duplicate bugs is disabled, he can directly enter all
110+ # details of the bug.
111+ product = self.factory.makeProduct()
112+ login_person(product.owner)
113+ product.official_malone = True
114+ product.enable_bugfiling_duplicate_search = False
115+ user = self.factory.makePerson()
116+ login_person(user)
117+ view = create_initialized_view(
118+ product, name='+filebug', principal=user)
119+ html = view.render()
120+ self.assertIsNot(None, find_tag_by_id(html, 'filebug-form'))
121+ # The search form to fing possible duplicates is not shown.
122+ self.assertIs(None, find_tag_by_id(html, 'filebug-search-form'))
123+
124+
125 def test_suite():
126 suite = unittest.TestSuite()
127 suite.addTest(unittest.makeSuite(TestBugTargetFileBugConfirmationMessage))
128
129=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
130--- lib/lp/bugs/interfaces/bugtarget.py 2010-11-30 21:39:25 +0000
131+++ lib/lp/bugs/interfaces/bugtarget.py 2010-12-03 09:00:42 +0000
132@@ -299,6 +299,13 @@
133
134 enable_bugfiling_duplicate_search = Bool(
135 title=u"Search for possible duplicate bugs when a new bug is filed",
136+ description=(
137+ u"If enabled, Launchpad searches the project for bugs which "
138+ u"could match the summary given by the bug reporter. However, "
139+ u"this can lead users to mistake an existing bug as the one "
140+ u"they want to report. This can happen for example for hardware "
141+ u"related bugs where the one symptom can be caused by "
142+ u"completely different hardware and drivers."),
143 required=False)
144
145 def createBug(bug_params):
146
147=== modified file 'lib/lp/bugs/templates/bugtarget-filebug-search.pt'
148--- lib/lp/bugs/templates/bugtarget-filebug-search.pt 2010-10-10 21:54:16 +0000
149+++ lib/lp/bugs/templates/bugtarget-filebug-search.pt 2010-12-03 09:00:42 +0000
150@@ -14,7 +14,8 @@
151 tal:define="lp_js string:${icingroot}/build"
152 tal:attributes="src string:${lp_js}/bugs/filebug-dupefinder.js"></script>
153
154- <script type="text/javascript">
155+ <script type="text/javascript"
156+ tal:condition="context/enable_bugfiling_duplicate_search">
157 LPS.use(
158 'base', 'node', 'oop', 'event', 'lp.bugs.filebug_dupefinder',
159 function(Y) {
160@@ -51,88 +52,96 @@
161 <div class="top-portlet"
162 tal:define="launchpad_form_id string:filebug-search-form"
163 tal:condition="not:view/extra_data_to_process">
164- <div metal:use-macro="context/@@launchpad_form/form">
165-
166- <table metal:fill-slot="widgets">
167-
168- <tal:product_widget
169- tal:define="widget nocall:view/widgets/product|nothing"
170- tal:condition="widget">
171- <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
172- </tal:product_widget>
173-
174- <tal:bugtarget
175- tal:define="widget nocall:view/widgets/bugtarget|nothing"
176- tal:condition="widget">
177- <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
178- </tal:bugtarget>
179-
180- <tal:hidden_tags tal:replace="structure view/widgets/tags/hidden" />
181-
182- <tr>
183- <td colspan="2">
184- <p>
185- Please describe the bug in a few words, for example, "weather
186- applet crashes on logout":
187- </p>
188- </td>
189- </tr>
190- <tal:title_widget tal:define="widget nocall:view/widgets/title">
191- <tal:comment replace="nothing">
192- The desire to have more control over the styling of this widget
193- prevents us from using the widget_row macro here.
194- </tal:comment>
195- <tr>
196- <td tal:define="field_name widget/context/__name__;
197- error python:view.getFieldError(field_name);
198- error_class python:('error' if error else None);"
199- tal:attributes="class error_class"
200- style="text-align: left; padding-left: 5em;">
201- <div>
202- <label tal:attributes="for widget/name"
203- tal:content="string:${widget/label}:">Label</label>
204- <input tal:replace="structure widget" />
205- </div>
206- <div class="message" tal:condition="error"
207- tal:content="structure error">Error message</div>
208- <p class="formHelp"
209- tal:condition="widget/hint"
210- tal:content="widget/hint">Some Help Text
211- </p>
212- </td>
213- <td style="text-align: left;">
214- <input tal:replace="structure view/actions/field.actions.search/render" />
215- <span id="spinner" style="text-align: center" class="unseen">
216- <img src="/@@/spinner" />
217- </span>
218- </td>
219- </tr>
220- </tal:title_widget>
221- </table>
222-
223- <div metal:fill-slot="buttons">
224- <tal:comment replace="nothing">
225- We add this to hide the standard action buttons.
226- </tal:comment>
227- </div>
228- </div>
229- </div>
230-
231- <div id="possible-duplicates" style="text-align: left;">
232- </div>
233- <div id="filebug-form-container" style="display: none;">
234- </div>
235-
236- <p style="display: none">
237- <a id="filebug-base-url"
238- tal:attributes="href view/inline_filebug_base_url"></a>
239- <a id="filebug-form-url"
240- tal:attributes="href view/inline_filebug_form_url"></a>
241- <a id="duplicate-search-url"
242- tal:attributes="href view/duplicate_search_url"></a>
243- </p>
244- </tal:uses-malone>
245- </div>
246+ <div tal:condition="not: context/enable_bugfiling_duplicate_search"
247+ omit-tag="">
248+ <metal:no-dupe-form
249+ metal:use-macro="context/@@+filebug-macros/simple-filebug-form" />
250+ </div>
251+
252+ <div tal:condition="context/enable_bugfiling_duplicate_search">
253+ <div metal:use-macro="context/@@launchpad_form/form">
254+
255+ <table metal:fill-slot="widgets">
256+
257+ <tal:product_widget
258+ tal:define="widget nocall:view/widgets/product|nothing"
259+ tal:condition="widget">
260+ <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
261+ </tal:product_widget>
262+
263+ <tal:bugtarget
264+ tal:define="widget nocall:view/widgets/bugtarget|nothing"
265+ tal:condition="widget">
266+ <metal:widget metal:use-macro="context/@@launchpad_form/widget_row" />
267+ </tal:bugtarget>
268+
269+ <tal:hidden_tags tal:replace="structure view/widgets/tags/hidden" />
270+
271+ <tr>
272+ <td colspan="2">
273+ <p>
274+ Please describe the bug in a few words, for example, "weather
275+ applet crashes on logout":
276+ </p>
277+ </td>
278+ </tr>
279+ <tal:title_widget tal:define="widget nocall:view/widgets/title">
280+ <tal:comment replace="nothing">
281+ The desire to have more control over the styling of this widget
282+ prevents us from using the widget_row macro here.
283+ </tal:comment>
284+ <tr>
285+ <td tal:define="field_name widget/context/__name__;
286+ error python:view.getFieldError(field_name);
287+ error_class python:('error' if error else None);"
288+ tal:attributes="class error_class"
289+ style="text-align: left; padding-left: 5em;">
290+ <div>
291+ <label tal:attributes="for widget/name"
292+ tal:content="string:${widget/label}:">Label</label>
293+ <input tal:replace="structure widget" />
294+ </div>
295+ <div class="message" tal:condition="error"
296+ tal:content="structure error">Error message</div>
297+ <p class="formHelp"
298+ tal:condition="widget/hint"
299+ tal:content="widget/hint">Some Help Text
300+ </p>
301+ </td>
302+ <td style="text-align: left;">
303+ <input tal:replace="structure view/actions/field.actions.search/render" />
304+ <span id="spinner" style="text-align: center" class="unseen">
305+ <img src="/@@/spinner" />
306+ </span>
307+ </td>
308+ </tr>
309+ </tal:title_widget>
310+ </table>
311+
312+ <div metal:fill-slot="buttons">
313+ <tal:comment replace="nothing">
314+ We add this to hide the standard action buttons.
315+ </tal:comment>
316+ </div>
317+ </div>
318+ </div>
319+ </div>
320+
321+ <div id="possible-duplicates" style="text-align: left;">
322+ </div>
323+ <div id="filebug-form-container" style="display: none;">
324+ </div>
325+
326+ <p style="display: none">
327+ <a id="filebug-base-url"
328+ tal:attributes="href view/inline_filebug_base_url"></a>
329+ <a id="filebug-form-url"
330+ tal:attributes="href view/inline_filebug_form_url"></a>
331+ <a id="duplicate-search-url"
332+ tal:attributes="href view/duplicate_search_url"></a>
333+ </p>
334+ </tal:uses-malone>
335+ </div>
336
337 </div>
338
339
340=== modified file 'lib/lp/registry/browser/distributionsourcepackage.py'
341--- lib/lp/registry/browser/distributionsourcepackage.py 2010-11-19 03:11:05 +0000
342+++ lib/lp/registry/browser/distributionsourcepackage.py 2010-12-03 09:00:42 +0000
343@@ -133,7 +133,7 @@
344 """Edit the details of this source package."""
345 # This is titled "Edit bug reporting guidelines" because that
346 # is the only editable property of a source package right now.
347- return Link('+edit', 'Edit bug reporting guidelines', icon='edit')
348+ return Link('+edit', 'Configure bug tracker', icon='edit')
349
350 def new_bugs(self):
351 base_path = "+bugs"
352@@ -544,6 +544,7 @@
353 field_names = [
354 'bug_reporting_guidelines',
355 'bug_reported_acknowledgement',
356+ 'enable_bugfiling_duplicate_search',
357 ]
358
359 @property
360
361=== modified file 'lib/lp/registry/browser/tests/distributionsourcepackage-views.txt'
362--- lib/lp/registry/browser/tests/distributionsourcepackage-views.txt 2010-11-17 00:21:51 +0000
363+++ lib/lp/registry/browser/tests/distributionsourcepackage-views.txt 2010-12-03 09:00:42 +0000
364@@ -199,7 +199,8 @@
365 The view allows the user the set the bug_reporting_guidelines field.
366
367 >>> view.field_names
368- ['bug_reporting_guidelines', 'bug_reported_acknowledgement']
369+ ['bug_reporting_guidelines', 'bug_reported_acknowledgement',
370+ 'enable_bugfiling_duplicate_search']
371
372 >>> print package.bug_reporting_guidelines
373 None

Subscribers

People subscribed via source and target branches

to status/vote changes: