Skip to content
Open
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
4 changes: 0 additions & 4 deletions app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class Config(object):
FF_SALESFORCE_CONTACT = env.bool("FF_SALESFORCE_CONTACT", True)
FF_CARETAKER = env.bool("FF_CARETAKER", False)
FF_USE_BILLABLE_UNITS = env.bool("FF_USE_BILLABLE_UNITS", False)
FF_ADD_TEMPLATE_PERM = env.bool("FF_ADD_TEMPLATE_PERM", False)
FF_REPORT_API = env.bool("FF_REPORT_API", False)

# Comma-separated list of service IDs allowed to use file attachments.
Expand Down Expand Up @@ -208,7 +207,6 @@ class Development(Config):
DEBUG = True
VITE_HMR_ENABLED = env.bool("VITE_HMR_ENABLED", True)
DEBUG_KEY = "debug"
FF_ADD_TEMPLATE_PERM = True
FF_REPORT_API = env.bool("FF_REPORT_API", False)
MOU_BUCKET_NAME = "notify.tools-mou"
ONE_CLICK_UNSUB_ALL_SERVICES = True
Expand Down Expand Up @@ -283,7 +281,6 @@ class Production(Config):


class Staging(Production):
FF_ADD_TEMPLATE_PERM = True
NOTIFY_ENVIRONMENT = NotifyEnv.STAGING.value
NOTIFY_LOG_LEVEL = "INFO"
SYSTEM_STATUS_URL = "https://status.staging.notification.cdssandbox.xyz"
Expand All @@ -297,7 +294,6 @@ class Scratch(Production):


class Dev(Production):
FF_ADD_TEMPLATE_PERM = True
NOTIFY_ENVIRONMENT = NotifyEnv.DEV.value
NOTIFY_LOG_LEVEL = "INFO"

Expand Down
2 changes: 1 addition & 1 deletion app/main/views/api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def create_api_key(service_id):
form=form,
disabled_options=disabled_options,
option_hints=option_hints,
show_manage_templates=current_app.config["FF_ADD_TEMPLATE_PERM"] and current_user.has_permissions("manage_api_keys"),
show_manage_templates=current_user.has_permissions("manage_api_keys"),
show_manage_reports=current_app.config["FF_REPORT_API"] and current_user.has_permissions("manage_api_keys"),
)

Expand Down
43 changes: 20 additions & 23 deletions tests/app/main/test_create_api_key_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ def test_create_api_key_page_shows_manage_templates_checkbox(
mock_get_live_service,
mock_has_permissions,
):
with set_config(app_, "FF_ADD_TEMPLATE_PERM", True):
page = client_request.get("main.create_api_key", service_id=SERVICE_ONE_ID)
page = client_request.get("main.create_api_key", service_id=SERVICE_ONE_ID)

checkbox = page.find("input", {"name": "permissions", "type": "checkbox"})
assert checkbox is not None
Expand All @@ -99,17 +98,16 @@ def test_create_api_key_with_manage_templates_permission(
return_value={"data": {"key": fake_uuid, "key_name": key_name_fixed}},
)

with set_config(app_, "FF_ADD_TEMPLATE_PERM", True):
client_request.post(
"main.create_api_key",
service_id=SERVICE_ONE_ID,
_data={
"key_name": key_name_from_user,
"key_type": "normal",
"permissions": "manage_templates",
},
_expected_status=200,
)
client_request.post(
"main.create_api_key",
service_id=SERVICE_ONE_ID,
_data={
"key_name": key_name_from_user,
"key_type": "normal",
"permissions": "manage_templates",
},
_expected_status=200,
)

post.assert_called_once_with(
url="/service/{}/api-key".format(SERVICE_ONE_ID),
Expand Down Expand Up @@ -140,16 +138,15 @@ def test_create_api_key_without_manage_templates_permission(
return_value={"data": {"key": fake_uuid, "key_name": key_name_fixed}},
)

with set_config(app_, "FF_ADD_TEMPLATE_PERM", True):
client_request.post(
"main.create_api_key",
service_id=SERVICE_ONE_ID,
_data={
"key_name": key_name_from_user,
"key_type": "normal",
},
_expected_status=200,
)
client_request.post(
"main.create_api_key",
service_id=SERVICE_ONE_ID,
_data={
"key_name": key_name_from_user,
"key_type": "normal",
},
_expected_status=200,
)

post.assert_called_once_with(
url="/service/{}/api-key".format(SERVICE_ONE_ID),
Expand Down
Loading