← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/fix-snap-breadcrumb into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/fix-snap-breadcrumb into lp:launchpad.

Commit message:
Fix typo in "Snap packages" breadcrumb link target.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/fix-snap-breadcrumb/+merge/272117

I happened to notice that the "Snap packages" breadcrumb (e.g. https://launchpad.net/~cjwatson/+snap/wget) is a broken link: it should point to Person:+snaps, not Person:+snap.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/fix-snap-breadcrumb into lp:launchpad.
=== modified file 'lib/lp/snappy/browser/snap.py'
--- lib/lp/snappy/browser/snap.py	2015-09-21 08:51:44 +0000
+++ lib/lp/snappy/browser/snap.py	2015-09-23 14:25:29 +0000
@@ -94,7 +94,7 @@
     def inside(self):
         return Breadcrumb(
             self.context.owner,
-            url=canonical_url(self.context.owner, view_name="+snap"),
+            url=canonical_url(self.context.owner, view_name="+snaps"),
             text="Snap packages", inside=self.context.owner)
 
 

=== modified file 'lib/lp/snappy/browser/tests/test_snap.py'
--- lib/lp/snappy/browser/tests/test_snap.py	2015-09-18 14:14:34 +0000
+++ lib/lp/snappy/browser/tests/test_snap.py	2015-09-23 14:25:29 +0000
@@ -9,11 +9,13 @@
     datetime,
     timedelta,
     )
+import re
 from textwrap import dedent
 
 from fixtures import FakeLogger
 from mechanize import LinkNotFoundError
 import pytz
+import soupmatchers
 from zope.component import getUtility
 from zope.publisher.interfaces import NotFound
 from zope.security.interfaces import Unauthorized
@@ -58,7 +60,10 @@
     find_tags_by_class,
     )
 from lp.testing.publication import test_traverse
-from lp.testing.views import create_initialized_view
+from lp.testing.views import (
+    create_initialized_view,
+    create_view,
+    )
 
 
 class TestSnapNavigation(TestCaseWithFactory):
@@ -404,6 +409,31 @@
             distroarchseries=self.distroarchseries, date_created=date_created,
             **kwargs)
 
+    def test_breadcrumb(self):
+        snap = self.makeSnap()
+        view = create_view(snap, "+index")
+        # To test the breadcrumbs we need a correct traversal stack.
+        view.request.traversed_objects = [self.person, snap, view]
+        view.initialize()
+        breadcrumbs_tag = soupmatchers.Tag(
+            "breadcrumbs", "ol", attrs={"class": "breadcrumbs"})
+        self.assertThat(
+            view(),
+            soupmatchers.HTMLContains(
+                soupmatchers.Within(
+                    breadcrumbs_tag,
+                    soupmatchers.Tag(
+                        "snap collection breadcrumb", "a",
+                        text="Snap packages",
+                        attrs={
+                            "href": re.compile(r"/~test-person/\+snaps$"),
+                            })),
+                soupmatchers.Within(
+                    breadcrumbs_tag,
+                    soupmatchers.Tag(
+                        "snap breadcrumb", "li",
+                        text=re.compile(r"\ssnap-name\s")))))
+
     def test_index_bzr(self):
         branch = self.factory.makePersonalBranch(
             owner=self.person, name="snap-branch")


Follow ups