mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Merge pull request #773 from GSA/notify-762
Notify 762 - Redirect notify.gov to beta.notify.gov
This commit is contained in:
38
tests/app/main/test_beta_redirect.py
Normal file
38
tests/app/main/test_beta_redirect.py
Normal file
@@ -0,0 +1,38 @@
|
||||
from flask import current_app
|
||||
|
||||
from app import create_beta_url
|
||||
|
||||
|
||||
def test_create_beta_url():
|
||||
url_for_redirect = create_beta_url("https://notify.gov/using-notify/get-started")
|
||||
assert url_for_redirect == "https://beta.notify.gov/using-notify/get-started"
|
||||
|
||||
|
||||
def test_no_redirect_notify_to_beta_non_production(monkeypatch, client_request):
|
||||
monkeypatch.setitem(current_app.config, "NOTIFY_ENVIRONMENT", "development")
|
||||
assert current_app.config["NOTIFY_ENVIRONMENT"] == "development"
|
||||
|
||||
client_request.get_response_from_url(
|
||||
"https://notify.gov/using-notify/get-started",
|
||||
_expected_status=200
|
||||
)
|
||||
|
||||
|
||||
def test_redirect_notify_to_beta(monkeypatch, client_request):
|
||||
monkeypatch.setitem(current_app.config, "NOTIFY_ENVIRONMENT", "production")
|
||||
assert current_app.config["NOTIFY_ENVIRONMENT"] == "production"
|
||||
|
||||
client_request.get_response_from_url(
|
||||
"https://notify.gov/using-notify/get-started",
|
||||
_expected_status=302
|
||||
)
|
||||
|
||||
|
||||
def test_no_redirect_beta_notify_to_beta(monkeypatch, client_request):
|
||||
monkeypatch.setitem(current_app.config, "NOTIFY_ENVIRONMENT", "production")
|
||||
assert current_app.config["NOTIFY_ENVIRONMENT"] == "production"
|
||||
|
||||
client_request.get_response_from_url(
|
||||
"https://beta.notify.gov/using-notify/get-started",
|
||||
_expected_status=200
|
||||
)
|
||||
@@ -2392,6 +2392,7 @@ def _client(notify_admin):
|
||||
Do not use this fixture directly – use `client_request` instead
|
||||
"""
|
||||
with notify_admin.test_request_context(), notify_admin.test_client() as client:
|
||||
client.allow_subdomain_redirects = True
|
||||
yield client
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user