mirror of
https://github.com/GSA/notifications-admin.git
synced 2025-12-10 07:03:12 -05:00
Updated code based on comments
This commit is contained in:
@@ -161,7 +161,7 @@
|
||||
"filename": "app/config.py",
|
||||
"hashed_secret": "577a4c667e4af8682ca431857214b3a920883efc",
|
||||
"is_verified": false,
|
||||
"line_number": 119,
|
||||
"line_number": 121,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
@@ -684,5 +684,5 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"generated_at": "2024-10-24T21:58:17Z"
|
||||
"generated_at": "2024-10-29T19:28:03Z"
|
||||
}
|
||||
|
||||
@@ -87,7 +87,9 @@ class Config(object):
|
||||
"tts-benefits-studio@gsa.gov",
|
||||
],
|
||||
}
|
||||
FEATURE_BEST_PRACTICES_ENABLED = getenv("FEATURE_BEST_PRACTICES_ENABLED", "false")
|
||||
FEATURE_BEST_PRACTICES_ENABLED = (
|
||||
getenv("FEATURE_BEST_PRACTICES_ENABLED", "false") == "true"
|
||||
)
|
||||
|
||||
|
||||
def _s3_credentials_from_env(bucket_prefix):
|
||||
|
||||
@@ -17,17 +17,15 @@ from app.main.views.sub_navigation_dictionaries import (
|
||||
from app.utils.user import user_is_logged_in
|
||||
from notifications_utils.url_safe_token import generate_token
|
||||
|
||||
feature_best_practices_enabled = (
|
||||
os.getenv("FEATURE_BEST_PRACTICES_ENABLED", "false").lower() == "true"
|
||||
)
|
||||
|
||||
|
||||
# Hook to check for guidance routes
|
||||
@main.before_request
|
||||
def check_guidance_feature():
|
||||
current_app.logger.warning("best practices 1234")
|
||||
current_app.logger.warning(current_app.config["FEATURE_BEST_PRACTICES_ENABLED"])
|
||||
if (
|
||||
request.path.startswith("/best-practices")
|
||||
and not feature_best_practices_enabled
|
||||
and not current_app.config["FEATURE_BEST_PRACTICES_ENABLED"]
|
||||
):
|
||||
abort(404)
|
||||
|
||||
@@ -276,7 +274,9 @@ def guidance_index():
|
||||
return render_template(
|
||||
"views/guidance/index.html",
|
||||
navigation_links=using_notify_nav(),
|
||||
feature_best_practices_enabled=feature_best_practices_enabled
|
||||
feature_best_practices_enabled=current_app.config[
|
||||
"FEATURE_BEST_PRACTICES_ENABLED"
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
env: demo
|
||||
instances: 1
|
||||
memory: 1G
|
||||
command: gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
command: newrelic-admin run-program gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
public_admin_route: notify-demo.app.cloud.gov
|
||||
cloud_dot_gov_route: notify-demo.app.cloud.gov
|
||||
redis_enabled: 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
env: production
|
||||
instances: 2
|
||||
memory: 1.5G
|
||||
command: gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
command: newrelic-admin run-program gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
public_admin_route: beta.notify.gov
|
||||
cloud_dot_gov_route: notify.app.cloud.gov
|
||||
redis_enabled: 1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
env: staging
|
||||
instances: 1
|
||||
memory: 1G
|
||||
command: gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
command: newrelic-admin run-program gunicorn -c /home/vcap/app/gunicorn_config.py application
|
||||
public_admin_route: notify-staging.app.cloud.gov
|
||||
cloud_dot_gov_route: notify-staging.app.cloud.gov
|
||||
redis_enabled: 1
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import os
|
||||
from functools import partial
|
||||
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
from flask import current_app, url_for
|
||||
from freezegun import freeze_time
|
||||
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
@@ -118,10 +117,6 @@ def test_static_pages(client_request, mock_get_organization_by_domain, view, moc
|
||||
|
||||
# Function to check if a view is feature-flagged and should return 404 when disabled
|
||||
def is_feature_flagged(view):
|
||||
|
||||
feature_best_practices_enabled = (
|
||||
os.getenv("FEATURE_BEST_PRACTICES_ENABLED", "false").lower() == "true"
|
||||
)
|
||||
feature_flagged_views = [
|
||||
"best_practices",
|
||||
"clear_goals",
|
||||
@@ -131,7 +126,10 @@ def test_static_pages(client_request, mock_get_organization_by_domain, view, moc
|
||||
"multiple_languages",
|
||||
"benchmark_performance",
|
||||
]
|
||||
return not feature_best_practices_enabled and view in feature_flagged_views
|
||||
return (
|
||||
not current_app.config["FEATURE_BEST_PRACTICES_ENABLED"]
|
||||
and view in feature_flagged_views
|
||||
)
|
||||
|
||||
request = partial(client_request.get, "main.{}".format(view))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user