~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
Adding BugTasks
===============

If a bug occurs in more than one place, you can request a fix in some
other software. You can request a fix in either a product or a
distribution. Let's start with a product, this is done using
+choose-affected-product, where you choose the actual product the bug
affects and creates the new bugtask.

    >>> login('test@canonical.com')
    >>> from lp.bugs.interfaces.bug import IBugSet
    >>> bug_four = getUtility(IBugSet).get(4)
    >>> len(bug_four.bugtasks)
    1
    >>> firefox_task = bug_four.bugtasks[0]

The views registered at +choose-affected-product and +distrotask are in
fact meta views responsible for calling other views in order to guide the
user through the workflow.  The following is a helper function that makes
sure the view is set up properly and returns the actual view rather than
our meta view.

    >>> def get_and_setup_view(context, name, form, method='POST'):
    ...     view = create_view(context, name, form=form, method=method)
    ...     view.initialize()
    ...     # We don't care about the actual rendering of the page, so we
    ...     # override the index template.
    ...     view.view.index = lambda: u''
    ...     return view.view
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form={}, method='GET')


We haven't posted the form, so we'll see one button.

    >>> [action.label for action in add_task_view.actions]
    [u'Continue']

Since we gave the view an upstream product as its context, it can't
guess which product we want to add, so it will ask us to specify it.

    >>> print add_task_view.widgets['product']._getFormInput()
    None
    >>> add_task_view.step_name
    'choose_product'

It also didn't add any notification prompting us to add packaging
information.

    >>> add_task_view.request.response.notifications
    []


If we POST the form without entering any information, it will complain
that product is required:

    >>> form = {
    ...     'field.actions.continue': '', 'field.product': '',
    ...     'field.__visited_steps__': 'choose_product'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.getFieldError('product')
    u'Required input is missing.'


If we supply a valid product, it will move on to the next step.

    >>> form = {
    ...     'field.actions.continue': '', 'field.product': 'evolution',
    ...     'field.add_packaging': 'off',
    ...     'field.__visited_steps__': 'choose_product'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'specify_remote_bug_url'

The URL widget is focused, to make it easier to paste the URL directly.

    >>> add_task_view.initial_focus_widget
    'bug_url'

If the validation fails, an error will be displayed.

    >>> form = {
    ...     'field.actions.continue': '', 'field.product': 'firefox',
    ...     'field.__visited_steps__': 'choose_product'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'choose_product'
    >>> add_task_view.getFieldError('product')
    u'A fix for this bug has already been requested for Mozilla Firefox'


When adding a product from an upstream task, we always have to choose
the product manually, since it's hard to guess which product that is
most likely to get added. Let's take a look how it works for packages,
which can have packaging links that helps us choose the product.

    >>> from lp.bugs.interfaces.bug import CreateBugParams
    >>> from lp.registry.interfaces.distribution import IDistributionSet
    >>> owner = getUtility(ILaunchBag).user
    >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
    >>> ubuntu_firefox = ubuntu.getSourcePackage('mozilla-firefox')
    >>> create_params = CreateBugParams(
    ...     owner, "Upstream bug", comment="An upstream bug.")
    >>> firefox_bug = ubuntu_firefox.createBug(create_params)
    >>> ubuntu_firefox_task = firefox_bug.bugtasks[0]


If we go to +choose-affected-product from the newly created bug task,
we immediately get directed to the next step with the correct upstream
selected.

    >>> add_task_view = get_and_setup_view(
    ...     ubuntu_firefox_task, '+choose-affected-product', form={},
    ...     method='GET')
    >>> add_task_view.step_name
    'specify_remote_bug_url'
    >>> add_task_view.widgets['product'].getInputValue().name
    u'firefox'

If some package doesn't have a packaging link, a product will have to
be chosen manually, and the user may choose to link the package to the
project..

    >>> ubuntu_thunderbird = ubuntu.getSourcePackage('thunderbird')
    >>> ignore = factory.makeSourcePackagePublishingHistory(
    ...     distroseries=ubuntu.currentseries,
    ...     sourcepackagename=ubuntu_thunderbird.sourcepackagename)
    >>> thunderbird_bug = ubuntu_thunderbird.createBug(create_params)
    >>> ubuntu_thunderbird_task = thunderbird_bug.bugtasks[0]

    >>> add_task_view = get_and_setup_view(
    ...     ubuntu_thunderbird_task, '+choose-affected-product', form={},
    ...     method='GET')

    >>> add_task_view.step_name
    'choose_product'
    >>> add_task_view.field_names
    ['product', 'add_packaging', '__visited_steps__']

    >>> print add_task_view.widgets['product']._getFormInput()
    None

Sometimes the distribution won't have any series, though. In that
case, we won't prompt the user to add a link, since he can't actually
add one.

    >>> gentoo = getUtility(IDistributionSet).getByName('gentoo')
    >>> gentoo.currentseries is None
    True
    >>> gentoo_thunderbird = gentoo.getSourcePackage('thunderbird')
    >>> thunderbird_bug = gentoo_thunderbird.createBug(create_params)
    >>> gentoo_thunderbird_task = thunderbird_bug.bugtasks[0]

    >>> add_task_view = get_and_setup_view(
    ...     gentoo_thunderbird_task, '+choose-affected-product', form={},
    ...     method='GET')
    >>> add_task_view.step_name
    'choose_product'
    >>> print add_task_view.widgets['product']._getFormInput()
    None

    >>> len(add_task_view.request.response.notifications)
    0

Let's take a look at the second step now, where we may enter the URL of
the remote bug and confirm the bugtask creation.
In order to show that all the events get fired off, let's create an
event listener and register it:

    >>> from zope.interface import Interface
    >>> from canonical.launchpad.ftests.event import TestEventListener
    >>> from lazr.lifecycle.interfaces import IObjectCreatedEvent

    >>> def on_created_event(object, event):
    ...     print "ObjectCreatedEvent: %r" % object

    >>> on_created_listener = TestEventListener(
    ...     Interface, IObjectCreatedEvent, on_created_event)


If an invalid product is specified, or a product that fails the
validation (for example, a bugtask for that product already exists),
the user will be kept in the first step and asked to choose the product.

Note that for the form of the second step to be processed we have to
include its (and all previous) step_name in field.__visited_steps__.

    >>> form = {
    ...     'field.actions.continue': '1',
    ...     'field.product': u'no-such-product',
    ...     'field.add_packaging': 'off',
    ...     'field.__visited_steps__':
    ...         'choose_product|specify_remote_bug_url',
    ...     }
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'choose_product'
    >>> print add_task_view.widgets['product']._getFormInput()
    no-such-product

    >>> form['field.product'] = u'firefox'
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'choose_product'
    >>> print add_task_view.widgets['product']._getFormInput()
    firefox

If we specify a valid product, no errors will occur, and a bugtask will
be created:

    >>> form['field.product'] = u'evolution'
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    ObjectCreatedEvent: <BugTask ...>

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    Evolution
    Mozilla Firefox

This worked without any problems since Evolution does use Malone as its
offical bug tracker.

    >>> evolution_task = bug_four.bugtasks[0]
    >>> evolution_task.target.bug_tracking_usage
    <DBItem ServiceUsage.LAUNCHPAD, (20) Launchpad>

    >>> transaction.commit()

If we try to add a task for ALSA, which doesn't use Malone, it won't go
as smoothly as above.

    >>> form['field.product'] = u'alsa-utils'
    >>> form['field.link_upstream_how'] = u'LINK_UPSTREAM'
    >>> form['field.bug_url'] = u''
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)

    >>> add_task_view.step_name
    'specify_remote_bug_url'
    >>> print add_task_view.widgets['product']._getFormInput()
    alsa-utils

As you can see, we're still in the second step, because the user has
tried to create a bugtask without a bug watch.

    >>> len(add_task_view.errors)
    1
    >>> add_task_view.getFieldError('bug_url')
    u'Required input is missing.'
    >>> add_task_view.next_url is None
    True

The user must explictly choose to create a bugtask without a bug
watch.

    >>> form['field.link_upstream_how'] = u'UNLINKED_UPSTREAM'
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    ObjectCreatedEvent: <BugTask ...>
    >>> print add_task_view.notifications
    []
    >>> add_task_view.next_url is not None
    True

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    alsa-utils
    Evolution
    Mozilla Firefox

But since no bug watch was specified, the status and importance
are set to the default values.

    >>> alsa_task = bug_four.bugtasks[0]
    >>> alsa_task.target.bug_tracking_usage
    <DBItem ServiceUsage.UNKNOWN, (10) Unknown>
    >>> alsa_task.status.title
    'New'
    >>> alsa_task.importance.title
    'Undecided'

On the same form, we can add a bug watch, by specifying the remote bug
URL. If we don't enter a valid URL, we get an error message.

    >>> form['field.product'] = u'gnome-terminal'
    >>> form['field.link_upstream_how'] = u'LINK_UPSTREAM'
    >>> form['field.bug_url'] = u'not-a-url'
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'specify_remote_bug_url'
    >>> print add_task_view.getFieldError('bug_url')
    Launchpad does not recognize the bug tracker at this URL.

Note that this caused the transaction to be aborted, thus the
alsa-utils bugtask added earlier is now gone:

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    Evolution
    Mozilla Firefox

If the URL is valid but there's no bugtracker registered with that URL,
we ask the user if he wants to register the bugtracker as well.

    >>> form['field.product'] = u'aptoncd'
    >>> form['field.bug_url'] = (
    ...     u'http://bugzilla.somewhere.org/bugs/show_bug.cgi?id=84')
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.step_name
    'bugtracker_creation'

Confirming the bugtracker creation will cause the new task to be added and
linked to the new bug watch.

    >>> form['field.__visited_steps__'] += "|%s" % add_task_view.step_name
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    ObjectCreatedEvent: <BugWatch at ...>
    ObjectCreatedEvent: <BugTask ...>

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    APTonCD
    Evolution
    Mozilla Firefox

    >>> for bugwatch in bug_four.watches:
    ...     print "%s: %s" % (bugwatch.bugtracker.title, bugwatch.remotebug)
    bugzilla.somewhere.org/bugs/: 84

If we specify a URL of an already registered bug tracker, both the task
and the bug watch will be added without any confirmation needed:

    >>> form['field.product'] = u'alsa-utils'
    >>> form['field.bug_url'] = (
    ...     u'http://bugzilla.gnome.org/bugs/show_bug.cgi?id=84')
    >>> form['field.__visited_steps__'] = (
    ...     "choose_product|specify_remote_bug_url")
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    ObjectCreatedEvent: <BugWatch at ...>
    ObjectCreatedEvent: <BugTask ...>

    >>> print add_task_view.notifications
    []

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    alsa-utils
    APTonCD
    Evolution
    Mozilla Firefox

    >>> for bugwatch in bug_four.watches:
    ...     print "%s: %s" % (bugwatch.bugtracker.title, bugwatch.remotebug)
    GnomeGBug GTracker: 84
    bugzilla.somewhere.org/bugs/: 84

The bug watch got linked to the created task, and all the bug task's
attributes got initialised to Unknown. The bugtask will be synced with
the bug watch's status later.

    >>> alsa_task = bug_four.bugtasks[0]
    >>> alsa_task.bugtargetname
    u'alsa-utils'
    >>> alsa_task.product.bug_tracking_usage
    <DBItem ServiceUsage.UNKNOWN, (10) Unknown>
    >>> alsa_task.bugwatch == bug_four.watches[0]
    True

    >>> alsa_task.status.title
    'Unknown'
    >>> alsa_task.importance.title
    'Unknown'

If the same bug watch is added to another bug, the bug watch will be
added, but a notification is shown to the user informing him that
another bug links to the same bug.

    >>> bug_five = getUtility(IBugSet).get(5)
    >>> bug_five_task = bug_five.bugtasks[0]
    >>> add_task_view = get_and_setup_view(
    ...     bug_five_task, '+choose-affected-product', form)
    ObjectCreatedEvent: <BugWatch at ...>
    ObjectCreatedEvent: <BugTask ...>

    >>> add_task_view.request.response.getHeader('Location')
    'http://.../+bug/5'

    >>> for notification in add_task_view.request.response.notifications:
    ...     print notification.message
    <a href="...">Bug #4</a> also links to the added bug watch
    (gnome-bugzilla #84).

    >>> for bugwatch in bug_five.watches:
    ...     print "%s: %s" % (bugwatch.bugtracker.title, bugwatch.remotebug)
    GnomeGBug GTracker: 84

There's a property for easily retrieving the target for use on the
confirmation page.

    >>> form['field.link_upstream_how'] = u'UNLINKED_UPSTREAM'
    >>> form['field.bug_url'] = u''
    >>> form['field.product'] = u'thunderbird'
    >>> form['field.__visited_steps__'] = u'choose_product'
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)
    >>> add_task_view.errors
    []
    >>> add_task_view.getTarget().displayname
    u'Mozilla Thunderbird'

If we request a fix in a source package, the distribution's display
name is returned.

    >>> form = {
    ...     'field.distribution': u'debian',
    ...     'field.sourcepackagename': u'evolution'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+distrotask', form)
    >>> add_task_view.getTarget().displayname
    u'Debian'


The form also accept binary package names to be entered. The binary
package will be converted to the corresponding source package.

    >>> form = {
    ...     'field.distribution': u'ubuntu',
    ...     'field.actions.continue': '1',
    ...     'field.sourcepackagename': u'mozilla-firefox-data'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+distrotask', form)
    ObjectCreatedEvent: <BugTask ...>
    >>> add_task_view.errors
    []

    >>> for bugtask in bug_four.bugtasks:
    ...     print bugtask.bugtargetdisplayname
    alsa-utils
    ...
    mozilla-firefox (Ubuntu)

    >>> on_created_listener.unregister()


Registering a product while adding a bugtask
============================================

One of the facilities we have when adding a bugtask is the option to target it
to a newly registered product.  When that option is used, though, we use the
URL of the remote bug to check if the product is not already registered and
present these already-registered products as options to the user.

    >>> form = {
    ...     'field.actions.continue': '1',
    ...     'field.bug_url': 'http://bugs.foo.org/bugs/show_bug.cgi?id=8',
    ...     'field.name': 'foo-product',
    ...     'field.displayname': 'The Foo Product',
    ...     'field.summary': 'The Foo Product'}
    >>> add_task_view = create_view(
    ...     firefox_task, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.initialize()

We have no products using http://bugs.foo.org as its bug tracker, so we have
nothing to present to the user.

    >>> print add_task_view.existing_products
    None

Since the user is just creating the product in Launchpad to link to an
upstream she probably isn't interested in maintaining the product for
the long-term.  In recognition of that we set the maintainer to be the
Registry Admins team while keeping the user as the registrant.

    >>> from lp.registry.interfaces.product import IProductSet
    >>> foo_product = getUtility(IProductSet).getByName('foo-product')
    >>> print foo_product.owner.displayname
    Registry Administrators
    >>> print foo_product.registrant.displayname
    Sample Person

The license is set to DONT_KNOW for now.
    >>> [license.name for license in foo_product.licenses]
    ['DONT_KNOW']

If the user tries to register another product using a bug URL under
bugs.foo.org, we'll present 'The Foo Product' as a candidate.

    >>> flush_database_updates()
    >>> form['field.name'] = 'bar-product'
    >>> form['field.displayname'] = 'The Bar'
    >>> form['field.summary'] = 'The Bar'
    >>> add_task_view = create_view(
    ...     firefox_task, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.initialize()
    >>> [product.name for product in add_task_view.existing_products]
    [u'foo-product']

    # Now we choose to register the product anyway, as it's not one of the
    # existing ones.
    >>> form['create_new'] = '1'
    >>> add_task_view = create_view(
    ...     firefox_task, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.initialize()

There's a limit on the number of existing products we present to the user in
this way, though.  If there are too many products using a given bugtracker,
we'll present only the ones whose name is similar to what the user entered.

    >>> flush_database_updates()
    >>> dummy = form.pop('create_new')
    >>> form['field.name'] = 'foo'
    >>> form['field.displayname'] = 'Foo, the return'
    >>> form['field.summary'] = 'Foo'
    >>> add_task_view = create_view(
    ...     firefox_task, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.initialize()
    >>> add_task_view.MAX_PRODUCTS_TO_DISPLAY
    10
    >>> [product.name for product in add_task_view.existing_products]
    [u'bar-product', u'foo-product']

    >>> add_task_view = create_view(
    ...     firefox_task, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.MAX_PRODUCTS_TO_DISPLAY = 1
    >>> add_task_view.initialize()
    >>> [product.name for product in add_task_view.existing_products]
    [u'foo-product']

Here another user will choose to report a bug on the existing project.
Note that we use another user to make sure our code doesn't attempt to
change the bugtracker of the existing project, as that wouldn't make
sense and could fail when the user didn't have the necessary rights on the
project in question.

    >>> login('no-priv@canonical.com')
    >>> dummy = form.pop('field.actions.continue')
    >>> form['field.existing_product'] = 'foo-product'
    >>> form['field.actions.use_existing_product'] = 1
    >>> bugtask_one = getUtility(IBugSet).get(1).bugtasks[0]
    >>> add_task_view = create_view(
    ...     bugtask_one, '+affects-new-product', form=form, method='POST')
    >>> add_task_view.initialize()
    >>> add_task_view.errors
    []
    >>> login('test@canonical.com')


IAddBugTaskForm Interface Definition
====================================

IAddBugTaskForm, which is used as the schema for the views tested above, has
some attributes which are identical to those of IUpstreamBugTask and
IDistroBugTask. However, we must ensure that IAddBugTask defines its own
attributes rather than borrowing those of IUpstreamBugTask and IDistroBugTask,
since doing so has produced OOPSes (bug 129406).

    >>> from lp.bugs.interfaces.bugtask import (
    ...     IAddBugTaskForm, IDistroBugTask, IUpstreamBugTask)
    >>> IAddBugTaskForm['product'] is IUpstreamBugTask['product']
    False

    >>> IAddBugTaskForm['distribution'] is IDistroBugTask['distribution']
    False

    >>> (IAddBugTaskForm['sourcepackagename'] is
    ...     IDistroBugTask['sourcepackagename'])
    False



Getting the upstream bug filing URL for a product
=================================================

Products that don't use Launchpad for bug tracking can be linked to
external bug trackers. In order to make it easier for users to file bugs
on upstream bug trackers, it's possible to get the bug filing and search
URLs for a Product's upstream bug tracker using its
`upstream_bugtracker_links` property.

We'll link a product to an upstream bug tracker to demonstrate this.

    >>> logout()
    >>> login('foo.bar@canonical.com')
    >>> bugtracker = factory.makeBugTracker('http://example.com')
    >>> product = factory.makeProduct(name='frobnitz')
    >>> product.official_malone = False
    >>> product.bugtracker = bugtracker
    >>> product.remote_product = u'foo'

    >>> def print_links(links_dict):
    ...     if links_dict is None:
    ...         print None
    ...         return
    ...
    ...     for key in sorted(links_dict):
    ...         print "%s: %s" % (key, links_dict[key])

upstream_bugtracker_links is a dict of `bug_filing_url` and `bug_search_url`.
The bug filing link includes the summary and description of the bug; the
search link includes the summary only.

    >>> form = {
    ...     'field.actions.continue': '', 'field.product': 'frobnitz',
    ...     'field.add_packaging': 'off',
    ...     'field.__visited_steps__': 'choose_product'}
    >>> add_task_view = get_and_setup_view(
    ...     firefox_task, '+choose-affected-product', form)

    >>> print_links(add_task_view.upstream_bugtracker_links)
    bug_filing_url:
    ...?product=foo&short_desc=Reflow%20...&long_desc=Originally%20...
    bug_search_url: ...query.cgi?product=foo&short_desc=Reflow%20problems...

If the product's `bugtracker` isn't specified its
`upstream_bugtracker_links` property will be None.

    >>> product.bugtracker = None
    >>> print_links(add_task_view.upstream_bugtracker_links)
    None

Similarly, if the product's `remote_product` attribute is None and its
bug tracker is one which requires an upstream product, bug bug_filing_url
and bug_search_url will be None.

    >>> product.bugtracker = bugtracker
    >>> product.remote_product = None
    >>> print_links(add_task_view.upstream_bugtracker_links)
    bug_filing_url: None
    bug_search_url: None

However, some remote bug trackers, notably Trac, only track one product
at a time. They don't need a remote product in order to provide a bug
filing URL, so the `upstream_bugtracker_links` for products linked to such
bug trackers will always be a usable URL.

    >>> from lp.bugs.interfaces.bugtracker import BugTrackerType
    >>> trac_bugtracker = factory.makeBugTracker(
    ...     'http://trac.example.com', BugTrackerType.TRAC)
    >>> product.bugtracker = trac_bugtracker

    >>> print_links(add_task_view.upstream_bugtracker_links)
    bug_filing_url: http://trac.example.com/newticket?summary=Reflow%20...
    bug_search_url: http://trac.example.com/search?ticket=on&q=Reflow%20...