Skip to content

Commit

Permalink
fix integration tests for butcher-axe (#4234)
Browse files Browse the repository at this point in the history
* fix integration tests for butcher-axe

* add redirects/tests for events
  • Loading branch information
escattone authored Jul 21, 2021
1 parent 520e5fa commit 2959568
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 13 deletions.
7 changes: 7 additions & 0 deletions libs/fundamental-redirects/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,13 @@ for (const [pattern, path] of [
}

const MISC_REDIRECT_PATTERNS = [
redirect(/^events\/?$/i, "https://community.mozilla.org/events/", {
permanent: false,
}),
localeRedirect(/^events\/?$/i, "https://community.mozilla.org/events/", {
prependLocale: false,
permanent: false,
}),
localeRedirect(/^account\/?$/i, "/settings", {
permanent: false,
}),
Expand Down
7 changes: 7 additions & 0 deletions testing/integration/headless/map_301.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,13 @@
)

MISC_REDIRECT_URLS = [
url_test("/events", "https://community.mozilla.org/events/", status_code=302),
url_test("/events/", "https://community.mozilla.org/events/", status_code=302),
url_test("/fr/events", "https://community.mozilla.org/events/", status_code=302),
url_test("/en-US/events", "https://community.mozilla.org/events/", status_code=302),
url_test(
"/en-US/events/", "https://community.mozilla.org/events/", status_code=302
),
url_test("/fr/account", "/fr/settings", status_code=302),
url_test("/en-US/account", "/en-US/settings", status_code=302),
url_test("/en-US/account/", "/en-US/settings", status_code=302),
Expand Down
16 changes: 4 additions & 12 deletions testing/integration/headless/test_cdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,9 @@ def assert_cached(
("/healthz", 204, None),
("/readiness", 204, None),
("/api/v1/whoami", 200, None),
("/en-US/users/signout", 302, "/"),
(
"/users/github/login/?next=/en-US/",
302,
lambda loc: loc.startswith("https://github.com/login/oauth/authorize"),
),
(
"/users/google/login/?next=/en-US/",
302,
lambda loc: loc.startswith("https://accounts.google.com/o/oauth2/auth"),
),
("/en-US/users/signout", 404, None),
("/users/github/login/?next=/en-US/", 404, None),
("/users/google/login/?next=/en-US/", 404, None),
("/admin/login/", 200, None),
("/admin/users/user/1/", 302, "/admin/login/?next=/admin/users/user/1/"),
("/en-US/docs/Learn/CSS/Styling_text/Fundamentals$samples/Color", 403, None),
Expand Down Expand Up @@ -193,7 +185,7 @@ def test_cached(base_url, is_behind_cdn, slug, status, expected_location):
)
def test_cached_attachments(base_url, attachment_url, is_behind_cdn, slug, status):
"""Ensure that these file-attachment requests are cached."""
expected_location = attachment_url + "/files/2767/hut.jpg"
expected_location = attachment_url + slug
assert_cached(base_url + slug, status, expected_location, is_behind_cdn)


Expand Down
1 change: 0 additions & 1 deletion testing/integration/headless/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def test_api_search(base_url):
"/search/",
"/search?q=video",
"/search/?q=video",
"/events",
"/signup",
"/signin",
"/settings",
Expand Down
15 changes: 15 additions & 0 deletions testing/tests/redirects.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,21 @@ const RETIRED_LOCALE_URLS = [].concat(
);

const MISC_REDIRECT_URLS = [].concat(
url_test("/events", "https://community.mozilla.org/events/", {
statusCode: 302,
}),
url_test("/events/", "https://community.mozilla.org/events/", {
statusCode: 302,
}),
url_test("/fr/events", "https://community.mozilla.org/events/", {
statusCode: 302,
}),
url_test("/en-US/events", "https://community.mozilla.org/events/", {
statusCode: 302,
}),
url_test("/en-US/events/", "https://community.mozilla.org/events/", {
statusCode: 302,
}),
url_test("/fr/account", "/fr/settings", { statusCode: 302 }),
url_test("/en-US/account", "/en-US/settings", { statusCode: 302 }),
url_test("/en-US/account/", "/en-US/settings", { statusCode: 302 }),
Expand Down

0 comments on commit 2959568

Please sign in to comment.