Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip out redirect rules but leave the infrastructure there #15904

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions bedrock/mozorg/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ def test_missing_doc_is_404(self):
class TestMozorgRedirects(TestCase):
"""Test redirects that are in bedrock.mozorg.nonlocale_urls"""

def test_projects_calendar_redirect(self):
resp = self.client.get("/projects/calendar/", follow=True)
# Note that we now 301 straight to the lang-prefixed version of the destination of the redirect
self.assertEqual(resp.redirect_chain[0], ("https://www.thunderbird.net/calendar/", 301))

def test_paris_office_redirect(self):
resp = self.client.get("/contact/spaces/paris/", follow=True, headers={"accept-language": "en"})
# Note that we now 301 straight to the lang-prefixed version of the destination of the redirect
Expand Down
1,237 changes: 2 additions & 1,235 deletions bedrock/redirects/redirects.py

Large diffs are not rendered by default.

1,240 changes: 3 additions & 1,237 deletions tests/redirects/map_301.py

Large diffs are not rendered by default.

44 changes: 1 addition & 43 deletions tests/redirects/map_410.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

URLS_410 = [
"/catalog/end-user/release",
"/help-wanted.html",
"/projects/ui/accessibility/access-radar.html",
"/projects/ui/accessibility/header.html",
"/projects/ui/accessibility/unix/to-do.html",
"/projects/user-docs/",
"/projects/user-docs/local/browserhelp/browserbanner.html",
"/projects/user-docs/local/browserhelp/browsercont.html",
"/projects/user-docs/local/browserhelp/browsertoc.html",
"/projects/user-docs/local/browserhelp/browsertop.html",
"/projects/user-docs/local/",
"/projects/user-docs/local/mailhelp/mailbanner.html",
"/projects/user-docs/local/mailhelp/mailcont.html",
"/projects/user-docs/local/mailhelp/mailtoc.html",
"/projects/user-docs/local/mailhelp/mailtop.html",
"/projects/user-docs/local/troubleshoot/troublebanner.html",
"/projects/user-docs/local/troubleshoot/troublecont.html",
"/projects/user-docs/local/troubleshoot/troubletoc.html",
"/projects/user-docs/local/troubleshoot/troubletop.html",
"/projects/user-docs/served/custhelp/custbanner.html",
"/projects/user-docs/served/custhelp/custcont.html",
"/projects/user-docs/served/custhelp/custtoc.html",
"/projects/user-docs/served/custhelp/custtop.html",
"/projects/user-docs/served/",
"/projects/user-docs/served/shophelp/shopbanner.html",
"/projects/user-docs/served/shophelp/shopcont.html",
"/projects/user-docs/served/shophelp/shoptoc.html",
"/projects/user-docs/served/shophelp/shoptop.html",
"/projects/user-docs/served/updatehelp/updatebanner.html",
"/projects/user-docs/served/updatehelp/updatecont.html",
"/projects/user-docs/served/updatehelp/updatetoc.html",
"/projects/user-docs/served/updatehelp/updatetop.html",
"/projects/user-docs/served/whatsnew/newbanner.html",
"/projects/user-docs/served/whatsnew/newcont.html",
"/projects/user-docs/served/whatsnew/newtoc.html",
"/projects/user-docs/served/whatsnew/newtop.html",
"/xpfe/xptoolkit/xbl.html",
# Bug 1428150
"/tabzilla/transbar.jsonp",
"/tabzilla/tabzilla.js",
"/tabzilla/media/js/tabzilla.js",
]
URLS_410 = []
1,326 changes: 2 additions & 1,324 deletions tests/redirects/map_globalconf.py

Large diffs are not rendered by default.

104 changes: 2 additions & 102 deletions tests/redirects/map_htaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,114 +2,14 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

import requests

from .base import flatten, url_test

URLS = flatten(
(
# Bug 774331 - European press pages
# en-GB
url_test("/en-GB/press/", "https://blog.mozilla.org/press-uk/"),
url_test("/en-GB/press/media/", "https://blog.mozilla.org/press-uk/media-library/"),
url_test("/en-GB/press/media/logos/", "https://blog.mozilla.org/press-uk/media-library/"),
url_test("/en-GB/press/media/screenshots/", "https://blog.mozilla.org/press-uk/media-library/product-screenshots/"),
url_test("/en-GB/press/media/images/", "https://blog.mozilla.org/press-uk/media-library/"),
url_test("/en-GB/press/media/videos/", "https://blog.mozilla.org/press-uk/media-library/videos/"),
# de
url_test("/de/press/", "https://blog.mozilla.org/press-de/"),
url_test("/de/press/media/", "https://blog.mozilla.org/press-de/medienbibliothek/"),
url_test("/de/press/media/logos/", "https://blog.mozilla.org/press-de/medienbibliothek/"),
url_test("/de/press/media/screenshots/", "https://blog.mozilla.org/press-de/medienbibliothek/produkt-screenshots/"),
url_test("/de/press/media/images/", "https://blog.mozilla.org/press-de/medienbibliothek/"),
url_test("/de/press/media/videos/", "https://blog.mozilla.org/press-de/medienbibliothek/videos/"),
url_test("/de/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
# fr
url_test("/fr/press/", "https://blog.mozilla.org/press-fr/"),
url_test("/fr/press/media/", "https://blog.mozilla.org/press-fr/bibliotheque-mozilla/"),
url_test("/fr/press/media/logos/", "https://blog.mozilla.org/press-fr/bibliotheque-mozilla/"),
url_test("/fr/press/media/screenshots/", "https://blog.mozilla.org/press-fr/bibliotheque-mozilla/captures-decran-produits/"),
url_test("/fr/press/media/images/", "https://blog.mozilla.org/press-fr/bibliotheque-mozilla/"),
url_test("/fr/press/media/videos/", "https://blog.mozilla.org/press-fr/bibliotheque-mozilla/videos/"),
url_test("/fr/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
# it
url_test("/it/press/", "https://blog.mozilla.org/press-it/"),
url_test("/it/press/media/", "https://blog.mozilla.org/press-it/galleria-multimediale/"),
url_test("/it/press/media/logos/", "https://blog.mozilla.org/press-it/galleria-multimediale/"),
url_test("/it/press/media/screenshots/", "https://blog.mozilla.org/press-it/galleria-multimediale/immagini-del-prodotto/"),
url_test("/it/press/media/images/", "https://blog.mozilla.org/press-it/galleria-multimediale/"),
url_test("/it/press/media/videos/", "https://blog.mozilla.org/press-it/galleria-multimediale/videos/"),
url_test("/it/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
# es
url_test("/es{,-ES,-AR,-MX}/press/", "https://blog.mozilla.org/press-es/"),
url_test("/es{,-ES,-AR,-MX}/press/media/", "https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/"),
url_test("/es{,-ES,-AR,-MX}/press/media/logos/", "https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/"),
url_test(
"/es{,-ES,-AR,-MX}/press/media/screenshots/", "https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/imagenes-del-producto/"
"/ignored/placeholder/to/allow/test/setup",
"/until-we-rempove-pytest.mark.skip-from-the-test/",
),
url_test("/es{,-ES,-AR,-MX}/press/media/images/", "https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/"),
url_test("/es{,-ES,-AR,-MX}/press/media/videos/", "https://blog.mozilla.org/press-es/galeria-multimedia-de-mozilla/videos/"),
url_test("/es{,-ES,-AR,-MX}/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
# pl
url_test("/pl/press/", "https://blog.mozilla.org/press-pl/"),
url_test("/pl/press/media/", "https://blog.mozilla.org/press-pl/galeria-multimediow/"),
url_test("/pl/press/media/logos/", "https://blog.mozilla.org/press-pl/galeria-multimediow/"),
url_test("/pl/press/media/screenshots/", "https://blog.mozilla.org/press-pl/galeria-multimediow/screenshoty-produktow/"),
url_test("/pl/press/media/images/", "https://blog.mozilla.org/press-pl/galeria-multimediow/"),
url_test("/pl/press/media/videos/", "https://blog.mozilla.org/press-pl/galeria-multimediow/videos/"),
url_test("/pl/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
# rest
# Bug 747565
url_test("/press/", "https://blog.mozilla.org/press/"),
url_test("/press/ataglance/", "https://blog.mozilla.org/press/ataglance/"),
url_test("/press/bios/", "https://blog.mozilla.org/press/bios/"),
url_test("/press/kits/", "https://blog.mozilla.org/press/kits/"),
url_test("/press/media/", "https://blog.mozilla.org/press/media-library/"),
url_test("/press/media/logos/", "https://blog.mozilla.org/press/media-library/"),
url_test("/press/media/bios/", "https://blog.mozilla.org/press/media-library/bios/"),
url_test("/press/media/screenshots/", "https://blog.mozilla.org/press/media-library/screenshots/"),
url_test("/press/media/videos/", "https://blog.mozilla.org/press/media-library/videos/"),
# Redirects for SeaMonkey project website, now living at seamonkey-project.org
url_test("/projects/seamonkey/", "http://www.seamonkey-project.org/"),
url_test("/projects/seamonkey/artwork.html", "http://www.seamonkey-project.org/dev/artwork"),
url_test("/projects/seamonkey/community.html", "http://www.seamonkey-project.org/community"),
url_test("/projects/seamonkey/get-involved.html", "http://www.seamonkey-project.org/dev/get-involved"),
url_test("/projects/seamonkey/index.html", "http://www.seamonkey-project.org/"),
url_test("/projects/seamonkey/news.html", "http://www.seamonkey-project.org/news"),
url_test("/projects/seamonkey/project-areas.html", "http://www.seamonkey-project.org/dev/project-areas"),
url_test("/projects/seamonkey/releases/", "http://www.seamonkey-project.org/releases/"),
url_test("/projects/seamonkey/releases/index.html", "http://www.seamonkey-project.org/releases/"),
url_test("/projects/seamonkey/review-and-flags.html", "http://www.seamonkey-project.org/dev/review-and-flags"),
url_test("/projects/seamonkey/releases/1.2.3.html", "http://www.seamonkey-project.org/releases/1.2.3"),
url_test("/projects/seamonkey/releases/seamonkey-man/index.html", "http://www.seamonkey-project.org/releases/seamonkey-man/"),
url_test("/projects/seamonkey/releases/seamonkey-dude/walter.html", "http://www.seamonkey-project.org/releases/seamonkey-dude/walter"),
url_test("/projects/seamonkey/releases/updates/so-good", "http://www.seamonkey-project.org/releases/updates/so-good"),
url_test("/projects/seamonkey/start/", "http://www.seamonkey-project.org/start/"),
# bug 1236910
url_test("/support/anything", "https://support.mozilla.org/"),
# Bug 682619
url_test("/support/thunderbird/problem", "https://support.mozilla.org/products/thunderbird"),
url_test("/support/firefox/bug", "https://support.mozilla.org/products/firefox"),
# Bug 638948 redirect beta privacy policy link
url_test("/firefox/beta/feedbackprivacypolicy/", "/privacy/firefox/"),
# Bug 424204
url_test("/en-US/firefox/help/", "https://support.mozilla.org/"),
# Bug 1255882
url_test("/some/url///", "/some/url/"),
url_test("////", "/en-US/", status_code=requests.codes.found),
url_test("/en-US///", "/en-US/"),
url_test("/de/firefox/about/", "/de/about/"),
# bug 1300373
url_test("/%2fgoogle.com//", "/google.com/"),
# bug 453506, 1255882
url_test("/editor/random/page.html", "http://www-archive.mozilla.org/editor/random/page.html"),
# bug 726217, 1255882
url_test("/projects/bonecho/anti-phishing/", "https://support.mozilla.org/kb/how-does-phishing-and-malware-protection-work"),
# Bug 453876, 840416
url_test("/add-ons/kodakcd", "https://addons.mozilla.org/en-US/firefox/addon/4441"),
# Bug 1255882
url_test("/firefox/personal.html", "/firefox/new/"),
url_test("/firefox/upgrade.html", "/firefox/new/"),
url_test("/firefox/ie.html", "/firefox/new/"),
)
)
4 changes: 4 additions & 0 deletions tests/redirects/test_redirects.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .map_locales import URLS as LOCALE_URLS


@pytest.mark.skip("Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
Expand All @@ -24,6 +25,7 @@ def test_301_url(url, base_url):
assert_valid_url(**url)


@pytest.mark.skip("Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
Expand All @@ -33,6 +35,7 @@ def test_global_conf_url(url, base_url):
assert_valid_url(**url)


@pytest.mark.skip("Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
Expand All @@ -42,6 +45,7 @@ def test_htaccess_url(url, base_url):
assert_valid_url(**url)


@pytest.mark.skip("Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
Expand Down
36 changes: 5 additions & 31 deletions tests/redirects/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .map_410 import URLS_410


@pytest.mark.skip(reason="Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
Expand All @@ -31,52 +32,25 @@ def test_404_url(base_url):
)


@pytest.mark.skip(reason="Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
@pytest.mark.parametrize(
"url",
[
"/firefox/android/",
"/firefox/android/faq/",
"/firefox/brand/",
"/firefox/channel/",
"/firefox/desktop/",
"/firefox/interest-dashboard/",
"/firefox/mobile/",
"/firefox/os/",
"/firefox/os/notes/1.1/",
"/firefox/partners/",
"/firefox/speed/",
"/firefox/tiles/",
"/firefox/unsupported/EOL/",
# Legacy URLs (Bug 1110927)
"/firefox/start/central.html",
"/firefox/sync/firstrun.html",
],
[],
)
def test_301_urls(url, base_url, follow_redirects=False):
assert_valid_url(url, base_url=base_url, follow_redirects=follow_redirects)


@pytest.mark.skip(reason="Disabled until we have redirects to test")
@pytest.mark.headless
@pytest.mark.nondestructive
@pytest.mark.django_db
@pytest.mark.parametrize(
"url",
[
"/firefox/",
"/firefox/all/",
"/firefox/developer/",
"/firefox/installer-help/",
"/firefox/latest/releasenotes/",
"/firefox/new/",
"/firefox/nightly/firstrun/",
"/firefox/releases/",
"/firefox/unsupported-systems/",
"/firefox/android/releasenotes/",
"/firefox/ios/releasenotes/",
],
[],
)
def test_302_urls(url, base_url, follow_redirects=False):
assert_valid_url(url, base_url=base_url, follow_redirects=follow_redirects, status_code=requests.codes.found)
Loading