You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2022/07/18 18:48:49 UTC

[allura] branch gc/8444 updated: fixup! [#8444] remove page=0 from url string for meta canonical and prev link

This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch gc/8444
in repository https://gitbox.apache.org/repos/asf/allura.git


The following commit(s) were added to refs/heads/gc/8444 by this push:
     new c7ad326a5 fixup! [#8444] remove page=0 from url string for meta canonical and prev link
c7ad326a5 is described below

commit c7ad326a5014e531b2c05338b3900a05dad6cd21
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Mon Jul 18 18:48:26 2022 +0000

    fixup! [#8444] remove page=0 from url string for meta canonical and prev link
---
 ForgeTracker/forgetracker/tests/functional/test_root.py | 9 ++++++---
 ForgeWiki/forgewiki/tests/functional/test_root.py       | 3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index b03e85c10..0d98c0a9b 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1405,12 +1405,15 @@ class TestFunctionalController(TrackerTestController):
         ThreadLocalORMSession.flush_all()
         response = self.app.get('/p/test/bugs/search/?q=test&limit=1')
         canonical = response.html.select_one('link[rel=canonical]')
-        assert ('limit=2' not in canonical['href'])
+        assert 'limit=2' not in canonical['href']
         response = self.app.get('/p/test/bugs/search/?q=test&limit=2&page=2')
         next = response.html.select_one('link[rel=next]')
-        assert ('page=3' in next['href'])
+        assert 'page=3' in next['href']
         prev = response.html.select_one('link[rel=prev]')
-        assert ('page=1' in prev['href'])
+        assert 'page=1' in prev['href']
+        response = self.app.get('/p/test/bugs/search/?q=test&limit=2&page=0')
+        canonical = response.html.select_one('link[rel=canonical]')
+        assert 'page=' not in canonical
 
 
     def test_search_with_strange_chars(self):
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index fff7e9c67..b34a2fde2 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -487,6 +487,9 @@ class TestRootController(TestController):
         assert('page=3' in next['href'])
         prev = r.html.select_one('link[rel=prev]')
         assert('page=1' in prev['href'])
+        r = self.app.get('/wiki/browse_tags/?page=0')
+        canonical = r.html.select_one('link[rel=canonical]')
+        assert 'page=' not in canonical
 
     def test_new_attachment(self):
         self.app.post(