Skip to content

Commit 7580199

Browse files
authored
Merge branch 'main' into chore/fix-broken-roadmap-stuff
2 parents 67c4493 + a4dd687 commit 7580199

8 files changed

Lines changed: 21 additions & 34 deletions

File tree

app/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,10 @@ def get_locale():
254254
application.jinja_env.globals["NotifyEnv"] = NotifyEnv
255255

256256
# Initialize the GC Organisation list
257-
if application.config["FF_SALESFORCE_CONTACT"]:
257+
application.config["IS_GC_ORGANISATIONS"] = bool(
258+
application.config["GC_ORGANISATIONS_BUCKET_NAME"] and application.config["GC_ORGANISATIONS_FILENAME"]
259+
)
260+
if application.config["IS_GC_ORGANISATIONS"]:
258261
application.config["CRM_ORG_LIST"] = get_gc_organisations(application)
259262

260263
# Specify packages to be traced by MonkeyType. This can be overriden

app/config.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class Config(object):
8888
EXTRA_ROUTES = [item for sublist in map(lambda x: x.values(), GC_ARTICLES_ROUTES.values()) for item in sublist]
8989

9090
# FEATURE FLAGS
91-
FF_SALESFORCE_CONTACT = env.bool("FF_SALESFORCE_CONTACT", True)
9291
FF_CARETAKER = env.bool("FF_CARETAKER", False)
9392
FF_USE_BILLABLE_UNITS = env.bool("FF_USE_BILLABLE_UNITS", False)
9493
FF_ADD_TEMPLATE_PERM = env.bool("FF_ADD_TEMPLATE_PERM", False)
@@ -235,10 +234,9 @@ class Test(Development):
235234
TESTING = True
236235
WTF_CSRF_ENABLED = False
237236
GC_ARTICLES_API = "articles.alpha.canada.ca/notification-gc-notify"
238-
FF_SALESFORCE_CONTACT = False
239237
SYSTEM_STATUS_URL = "https://localhost:3000"
240238
NO_BRANDING_ID = "0af93cf1-2c49-485f-878f-f3e662e651ef"
241-
GC_ORGANISATIONS_BUCKET_NAME = "test-gc-organisations"
239+
GC_ORGANISATIONS_BUCKET_NAME = None
242240
FF_USE_BILLABLE_UNITS = True
243241
VITE_HMR_ENABLED = False
244242

@@ -260,10 +258,9 @@ class ProductionFF(Config):
260258
TESTING = True
261259
WTF_CSRF_ENABLED = False
262260
GC_ARTICLES_API = "articles.alpha.canada.ca/notification-gc-notify"
263-
FF_SALESFORCE_CONTACT = False
264261
SYSTEM_STATUS_URL = "https://localhost:3000"
265262
NO_BRANDING_ID = "0af93cf1-2c49-485f-878f-f3e662e651ef"
266-
GC_ORGANISATIONS_BUCKET_NAME = "dev-gc-organisations"
263+
GC_ORGANISATIONS_BUCKET_NAME = None
267264
FF_USE_BILLABLE_UNITS = False
268265
FF_REPORT_API = False
269266

app/main/views/add_service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767

6868

6969
def get_wizard_order() -> list[str]:
70-
if current_app.config["FF_SALESFORCE_CONTACT"]:
70+
if current_app.config["IS_GC_ORGANISATIONS"]:
7171
return [STEP_LOGO, STEP_SERVICE_AND_EMAIL, STEP_ORGANISATION]
7272
return [STEP_LOGO, STEP_SERVICE_AND_EMAIL]
7373

@@ -157,7 +157,7 @@ def _renderTemplateStep(form, current_step: str, government_type: Optional[str])
157157
step_num = WIZARD_ORDER.index(current_step) + 1
158158

159159
autocomplete_data = None
160-
if current_app.config["FF_SALESFORCE_CONTACT"] and current_step == STEP_ORGANISATION:
160+
if current_app.config["IS_GC_ORGANISATIONS"] and current_step == STEP_ORGANISATION:
161161
autocomplete_data = current_app.config["CRM_ORG_LIST"].get("names", {})
162162

163163
if step_num > 1:
@@ -232,9 +232,9 @@ def add_service():
232232
service_name = data["name"]
233233
default_branding_is_french = data["default_branding"] == FieldWithLanguageOptions.FRENCH_OPTION_VALUE
234234
# organisation_notes will be visible at the go live request
235-
if current_app.config["FF_SALESFORCE_CONTACT"] and government_type != GOVERNMENT_TYPE_OTHER:
235+
if current_app.config["IS_GC_ORGANISATIONS"] and government_type != GOVERNMENT_TYPE_OTHER:
236236
organisation_notes = f"{data['parent_organisation_name']} > {data['child_organisation_name']}"
237-
elif current_app.config["FF_SALESFORCE_CONTACT"] and government_type == GOVERNMENT_TYPE_OTHER:
237+
elif current_app.config["IS_GC_ORGANISATIONS"] and government_type == GOVERNMENT_TYPE_OTHER:
238238
organisation_notes = data["other_organisation_name"]
239239
else:
240240
organisation_notes = None

app/main/views/service_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def terms_of_use(service_id):
264264
@user_is_gov_user
265265
def use_case(service_id):
266266
DEFAULT_STEP = "about-service"
267-
display_org_question = not current_service.organisation_notes or not current_app.config["FF_SALESFORCE_CONTACT"]
267+
display_org_question = not current_service.organisation_notes or not current_app.config["IS_GC_ORGANISATIONS"]
268268
steps = [
269269
{
270270
"form": GoLiveAboutServiceForm if display_org_question else GoLiveAboutServiceFormNoOrg,

app/templates/partials/add-service/step-create-service.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ <h2 class="heading-medium">{{ _("Email address") }}</h2>
4141
</p>
4242
<p>{{ _("This email address cannot receive replies. In Settings, you can enter a different email for replies. Currently your service is set to prevent replies.") }}</p>
4343

44-
{% if config["FF_SALESFORCE_CONTACT"] %}
44+
{% if config["IS_GC_ORGANISATIONS"] %}
4545
{% set button_txt = _('Continue') %}
4646
{% else %}
4747
{% set button_txt = _('Create service') %}

tests/app/main/views/test_add_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ def test_wizard_flow_with_step_2_should_call_email_from_is_unique(
183183
assert mock_create_or_update_free_sms_fragment_limit.called is True
184184

185185

186-
def test_wizard_flow_with_step_2_post_should_go_to_step_3_with_ff(
186+
def test_wizard_flow_with_step_2_post_should_go_to_step_3_with_gc_organisations(
187187
app_: Flask,
188188
client_request,
189189
mock_service_email_from_is_unique,
190190
mock_service_name_is_unique,
191191
):
192-
app_.config["FF_SALESFORCE_CONTACT"] = True
192+
app_.config["IS_GC_ORGANISATIONS"] = True
193193
app_.config["CRM_ORG_LIST"] = {"en": ["CDS", "TBS"]}
194194
with client_request.session_transaction() as session:
195195
session["add_service_form"] = dict(default_branding=FieldWithLanguageOptions.ENGLISH_OPTION_VALUE)
@@ -227,7 +227,7 @@ def test_wizard_flow_with_step_3_should_create_service(
227227
):
228228
mocker.patch("app.service_api_client.is_service_name_unique", return_value=True)
229229
mocker.patch("app.service_api_client.is_service_email_from_unique", return_value=True)
230-
app_.config["FF_SALESFORCE_CONTACT"] = True
230+
app_.config["IS_GC_ORGANISATIONS"] = True
231231
app_.config["CRM_ORG_LIST"] = {"en": ["CDS", "TBS"]}
232232
with client_request.session_transaction() as session:
233233
session["add_service_form"] = dict(
@@ -259,7 +259,7 @@ def test_wizard_flow_with_step_3_should_not_create_service_no_parent_org(
259259
mock_create_service,
260260
mock_create_or_update_free_sms_fragment_limit,
261261
):
262-
app_.config["FF_SALESFORCE_CONTACT"] = True
262+
app_.config["IS_GC_ORGANISATIONS"] = True
263263
app_.config["CRM_ORG_LIST"] = {"en": ["CDS", "TBS"]}
264264
with client_request.session_transaction() as session:
265265
session["add_service_form"] = dict(
@@ -287,7 +287,7 @@ def test_wizard_flow_with_step_3b_should_create_service(
287287
):
288288
mocker.patch("app.service_api_client.is_service_name_unique", return_value=True)
289289
mocker.patch("app.service_api_client.is_service_email_from_unique", return_value=True)
290-
app_.config["FF_SALESFORCE_CONTACT"] = True
290+
app_.config["IS_GC_ORGANISATIONS"] = True
291291
app_.config["CRM_ORG_LIST"] = {"en": ["CDS", "TBS"]}
292292
with client_request.session_transaction() as session:
293293
session["add_service_form"] = dict(
@@ -316,7 +316,7 @@ def test_wizard_flow_with_step_3b_create_service_no_org(
316316
mock_create_service,
317317
mock_create_or_update_free_sms_fragment_limit,
318318
):
319-
app_.config["FF_SALESFORCE_CONTACT"] = True
319+
app_.config["IS_GC_ORGANISATIONS"] = True
320320
app_.config["CRM_ORG_LIST"] = {"en": ["CDS", "TBS"]}
321321
with client_request.session_transaction() as session:
322322
session["add_service_form"] = dict(

tests/app/main/views/test_service_settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ def test_request_to_go_live_use_case_page(
11041104

11051105

11061106
@pytest.mark.parametrize(
1107-
"salesforce_feature_flag, organisation_notes, organisation_question_visible",
1107+
"is_gc_organisations, organisation_notes, organisation_question_visible",
11081108
(
11091109
(False, "Some department > Some group", True),
11101110
(False, "", True),
@@ -1117,11 +1117,11 @@ def test_request_to_go_live_use_case_page_hides_organisation(
11171117
mocker: MockerFixture,
11181118
app_: Flask,
11191119
service_one: Service,
1120-
salesforce_feature_flag: bool,
1120+
is_gc_organisations: bool,
11211121
organisation_notes: str,
11221122
organisation_question_visible: bool,
11231123
):
1124-
with set_config(app_, "FF_SALESFORCE_CONTACT", salesforce_feature_flag):
1124+
with set_config(app_, "IS_GC_ORGANISATIONS", is_gc_organisations):
11251125
use_case_data_mock = mocker.patch("app.service_api_client.get_use_case_data")
11261126
use_case_data_mock.return_value = None
11271127
service_one.organisation_notes = organisation_notes # type: ignore

tests/conftest.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
from freezegun import freeze_time
1616
from notifications_python_client.errors import HTTPError
1717
from notifications_utils.url_safe_token import generate_token
18-
from pytest_mock import MockerFixture
1918
from werkzeug.exceptions import NotFound
2019

2120
from app import create_app
@@ -4671,18 +4670,6 @@ def mock_GCA_404(mocker):
46714670
)
46724671

46734672

4674-
@pytest.fixture(scope="function")
4675-
def mock_salesforce_get_accounts(mocker: MockerFixture):
4676-
mock_crm_orgs = [
4677-
"Accessibility Standards Canada",
4678-
"Canada Post",
4679-
"Canada Revenue Agency",
4680-
"National Film Board",
4681-
"Royal Canadian Mint",
4682-
]
4683-
return mocker.patch("app.salesforce_account.get_accounts", return_value=mock_crm_orgs)
4684-
4685-
46864673
def create_api_user_active(with_unique_id=False):
46874674
return {
46884675
"id": str(uuid4()) if with_unique_id else sample_uuid(),

0 commit comments

Comments
 (0)