← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:translation-import-queue-https into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:translation-import-queue-https into launchpad:master.

Commit message:
Link to translation import files using HTTPS

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1989473 in Launchpad itself: "Translation import files available over http instead of https "
  https://bugs.launchpad.net/launchpad/+bug/1989473

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/429900
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:translation-import-queue-https into launchpad:master.
diff --git a/lib/lp/translations/browser/tests/test_hastranslationimports.py b/lib/lp/translations/browser/tests/test_hastranslationimports.py
new file mode 100644
index 0000000..7a660f5
--- /dev/null
+++ b/lib/lp/translations/browser/tests/test_hastranslationimports.py
@@ -0,0 +1,28 @@
+# Copyright 2022 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+import re
+
+from lp.services.webapp.publisher import canonical_url
+from lp.testing import TestCaseWithFactory
+from lp.testing.layers import LaunchpadFunctionalLayer
+from lp.testing.pages import find_tags_by_class
+
+
+class TestHasTranslationImportsView(TestCaseWithFactory):
+
+    layer = LaunchpadFunctionalLayer
+
+    def test_https(self):
+        self.pushConfig("librarian", use_https=True)
+        distroseries = self.factory.makeUbuntuDistroSeries()
+        entry = self.factory.makeTranslationImportQueueEntry(
+            distroseries=distroseries
+        )
+        queue_url = canonical_url(distroseries, view_name="+imports")
+        browser = self.getUserBrowser(url=queue_url)
+        import_sources = find_tags_by_class(browser.contents, "import_source")
+        self.assertRegex(
+            import_sources[0].a["href"],
+            r"^https://.*/"; + re.escape(entry.path),
+        )
diff --git a/lib/lp/translations/templates/translation-import-queue-macros.pt b/lib/lp/translations/templates/translation-import-queue-macros.pt
index a7b609e..0d533e2 100644
--- a/lib/lp/translations/templates/translation-import-queue-macros.pt
+++ b/lib/lp/translations/templates/translation-import-queue-macros.pt
@@ -80,7 +80,7 @@
                     <span class="download sprite"></span>
                   </td>
                   <td class="import_source">
-                    <a tal:attributes="href entry/content/http_url"
+                    <a tal:attributes="href entry/content/getURL"
                        tal:content="entry/path">po/foo.pot</a> in
                     <a tal:condition="entry/sourcepackage"
                        tal:replace="structure entry/sourcepackage/fmt:link">