Skip to content

Commit

Permalink
fix(test_template): only run the test with the FF on
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleith committed Dec 6, 2024
1 parent 6b277bd commit dfe6107
Showing 1 changed file with 37 additions and 34 deletions.
71 changes: 37 additions & 34 deletions tests/app/main/views/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
fake_uuid,
mock_get_service_template_with_process_type,
normalize_spaces,
set_config,
)

DEFAULT_PROCESS_TYPE = TemplateProcessTypes.BULK.value
Expand Down Expand Up @@ -2703,41 +2704,43 @@ def test_should_hide_send_buttons_when_appropriate(
remaining_daily,
remaining_annual,
buttons_shown,
app_,
):
mock_notification_counts_client.get_limit_stats.return_value = {
"email": {
"annual": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_annual, # The number of email notifications remaining this year
},
"daily": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_daily, # The number of email notifications remaining today
},
},
"sms": {
"annual": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_annual, # The number of email notifications remaining this year
with set_config(app_, "FF_ANNUAL_LIMIT", True): # REMOVE LINE WHEN FF REMOVED
mock_notification_counts_client.get_limit_stats.return_value = {
"email": {
"annual": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_annual, # The number of email notifications remaining this year
},
"daily": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_daily, # The number of email notifications remaining today
},
},
"daily": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_daily, # The number of email notifications remaining today
"sms": {
"annual": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_annual, # The number of email notifications remaining this year
},
"daily": {
"limit": 1, # doesn't matter for our test
"sent": 1, # doesn't matter for our test
"remaining": remaining_daily, # The number of email notifications remaining today
},
},
},
}
}

page = client_request.get(
".view_template",
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_test_page_title=False,
)
if buttons_shown:
assert page.find(attrs={"data-testid": "send-buttons"}) is not None
else:
assert page.find(attrs={"data-testid": "send-buttons"}) is None
page = client_request.get(
".view_template",
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_test_page_title=False,
)
if buttons_shown:
assert page.find(attrs={"data-testid": "send-buttons"}) is not None
else:
assert page.find(attrs={"data-testid": "send-buttons"}) is None

0 comments on commit dfe6107

Please sign in to comment.