← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/snap-upload-error-no-link into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/snap-upload-error-no-link into lp:launchpad.

Commit message:
Fix rendering of snap builds with store_upload_error_messages items without a link.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1758005 in Launchpad itself: "OOPS on checking build status when uploading to incorrect snap name"
  https://bugs.launchpad.net/launchpad/+bug/1758005

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/snap-upload-error-no-link/+merge/341889
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/snap-upload-error-no-link into lp:launchpad.
=== modified file 'lib/lp/snappy/browser/tests/test_snapbuild.py'
--- lib/lp/snappy/browser/tests/test_snapbuild.py	2018-02-19 17:51:30 +0000
+++ lib/lp/snappy/browser/tests/test_snapbuild.py	2018-03-22 10:38:42 +0000
@@ -1,4 +1,4 @@
-# Copyright 2015-2017 Canonical Ltd.  This software is licensed under the
+# Copyright 2015-2018 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Test snap package build views."""
@@ -140,6 +140,9 @@
         naked_job.job._status = JobStatus.FAILED
         naked_job.error_message = "This should not be shown."
         naked_job.error_messages = [
+            {"message": (
+                "The new version submitted for 'name' does not match the "
+                "upload ('other-name').")},
             {"message": "Scan failed.", "link": "link1"},
             {"message": "Classic not allowed.", "link": "link2"}]
         build_view = create_initialized_view(build, "+index")
@@ -162,6 +165,14 @@
                 soupmatchers.Tag(
                     "store upload error messages", "ul",
                     attrs={"id": "store-upload-error-messages"}),
+                soupmatchers.Tag(
+                    "store upload error message", "li",
+                    text=re.compile(".*The new version.*")))))
+        self.assertThat(built_view, soupmatchers.HTMLContains(
+            soupmatchers.Within(
+                soupmatchers.Tag(
+                    "store upload error messages", "ul",
+                    attrs={"id": "store-upload-error-messages"}),
                 soupmatchers.Within(
                     soupmatchers.Tag(
                         "store upload error message", "li",

=== modified file 'lib/lp/snappy/templates/snapbuild-index.pt'
--- lib/lp/snappy/templates/snapbuild-index.pt	2018-02-22 15:41:03 +0000
+++ lib/lp/snappy/templates/snapbuild-index.pt	2018-03-22 10:38:42 +0000
@@ -183,7 +183,7 @@
           <ul id="store-upload-error-messages">
             <li tal:repeat="error context/store_upload_error_messages">
               <span tal:replace="error/message"/>
-              <a tal:condition="error/link"
+              <a tal:condition="error/link|nothing"
                   tal:attributes="href error/link"
                   target="_blank"
                   class="sprite maybe action-icon">(?)</a>


Follow ups