Merge lp:~mwhudson/launchpad/branchlisting-series-link-bug-457999 into lp:launchpad

Proposed by Michael Hudson-Doyle on 2009-10-28
Status: Merged
Approved by: Paul Hummer on 2009-10-29
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/branchlisting-series-link-bug-457999
Merge into: lp:launchpad
Diff against target: 59 lines
2 files modified
lib/lp/code/browser/tests/test_branchlisting.py (+20/-0)
lib/lp/code/templates/branch-listing.pt (+1/-1)
To merge this branch: bzr merge lp:~mwhudson/launchpad/branchlisting-series-link-bug-457999
Reviewer Review Type Date Requested Status
Paul Hummer (community) 2009-10-28 Approve on 2009-10-29
Review via email: mp+14123@code.launchpad.net

Commit message

On a branchlisting page, for a series branch the link to the series now goes to the series on the main site.

To post a comment you must log in.
Michael Hudson-Doyle (mwhudson) wrote :

Curtis' diagnosis on the bug is correct.

One of those where the test took 100 times longer than the fix -- but the fix only took 5 seconds, so that's probably OK.

Cheers,
mwh

Paul Hummer (rockstar) wrote :

On Wed, 28 Oct 2009 23:50:27 -0000
Michael Hudson <email address hidden> wrote:
> One of those where the test took 100 times longer than the fix -- but the fix
> only took 5 seconds, so that's probably OK.

Yea, the test is a little more involved than the fix. :)

 review approve
 merge approved

Cheers,
Paul

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/browser/tests/test_branchlisting.py'
2--- lib/lp/code/browser/tests/test_branchlisting.py 2009-10-21 01:24:58 +0000
3+++ lib/lp/code/browser/tests/test_branchlisting.py 2009-10-28 23:50:26 +0000
4@@ -7,8 +7,11 @@
5
6 from datetime import timedelta
7 from pprint import pformat
8+import re
9 import unittest
10
11+from lazr.uri import URI
12+
13 from storm.expr import Asc, Desc
14 from zope.component import getUtility
15 from zope.security.proxy import removeSecurityProxy
16@@ -25,6 +28,7 @@
17 from lp.registry.interfaces.pocket import PackagePublishingPocket
18 from lp.testing import TestCase, TestCaseWithFactory, time_counter
19 from lp.testing.views import create_initialized_view
20+from canonical.launchpad.webapp import canonical_url
21 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
22 from canonical.testing.layers import DatabaseFunctionalLayer
23
24@@ -330,6 +334,22 @@
25 self.assertEqual(identity, view_branch.bzr_identity)
26
27
28+class TestProductSeriesTemplate(TestCaseWithFactory):
29+
30+ layer = DatabaseFunctionalLayer
31+
32+ def test_product_series_link(self):
33+ # The link from a series branch's listing to the series goes to the
34+ # series on the main site, not the code site.
35+ branch = self.factory.makeProductBranch()
36+ series = self.factory.makeProductSeries(product=branch.product)
37+ series.branch = branch
38+ browser = self.getUserBrowser(
39+ canonical_url(branch.product, rootsite='code'))
40+ link = browser.getLink(re.compile('^' + series.name + '$'))
41+ self.assertEqual('launchpad.dev', URI(link.url).host)
42+
43+
44 def test_suite():
45 return unittest.TestLoader().loadTestsFromName(__name__)
46
47
48=== modified file 'lib/lp/code/templates/branch-listing.pt'
49--- lib/lp/code/templates/branch-listing.pt 2009-08-18 22:26:02 +0000
50+++ lib/lp/code/templates/branch-listing.pt 2009-10-28 23:50:26 +0000
51@@ -249,7 +249,7 @@
52 link rather than having a space after it.
53 </tal:comment>
54 <tal:series-link>
55- <a tal:attributes="href series/fmt:url" tal:content="series/name">
56+ <a tal:attributes="href series/fmt:url:mainsite" tal:content="series/name">
57 trunk
58 </a></tal:series-link><tal:comma condition="not: repeat/series/end">,</tal:comma>
59 </tal:associated-series>