Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added in integration test dummy values to functional test SSM init script. #4251

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
60 changes: 43 additions & 17 deletions app/functional_tests_fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,24 @@ def apply_fixtures():
current_app.logger.info("--> Ensure inbound number exists")
inbound_number_id = _create_inbound_numbers(service.id, service_admin_user.id)

template1_id = _create_email_template(service, service_admin_user.id)
template2_id = _create_sms_template(service, service_admin_user.id)
template3_id = _create_letter_template(service, service_admin_user.id)
template1_id = _create_email_template(service, service_admin_user.id,
"Functional Tests - CSV Email Template with Build ID",
"Functional Tests - CSV Email",
"The quick brown fox jumped over the lazy dog. Build id: ((build_id)).")
template2_id = _create_sms_template(service, service_admin_user.id, "Functional Tests - CSV SMS Template with Build ID", "The quick brown fox jumped over the lazy dog. Build id: ((build_id)).")
template3_id = _create_letter_template(service, service_admin_user.id,
"Functional Tests - CSV Letter Template with Build ID",
"Functional Tests - CSV Letter",
"The quick brown fox jumped over the lazy dog. Build id: ((build_id))." )
template4_id = _create_email_template(service, service_admin_user.id,
"Client Functional test email template",
"Functional Tests are good",
"Hello ((name))\n\nFunctional test help make our world a better place")
template5_id = _create_sms_template(service, service_admin_user.id, "Client Functional test sms template", "Hello ((name))\n\nFunctional Tests make our world a better place")
template6_id = _create_letter_template(service, service_admin_user.id,
"Functional Tests - CSV Letter Template with something different Build ID",
"Functional Tests - CSV Letter",
"The quick brown fox jumped over the lazy dog. Build id: ((build_id))." )

current_app.logger.info("--> Ensure service email reply to exists")
_create_service_email_reply_to(
Expand Down Expand Up @@ -192,6 +207,21 @@ def apply_fixtures():

export REQUEST_BIN_API_TOKEN={request_bin_api_token}

# Exporting for integration tests: TODO ACTUALLY GENERATE THESE - THEY WON'T WORK
export API_CLIENT_INTEGRATION_TESTS_SERVICE_ID='{service.id}'
export API_CLIENT_INTEGRATION_TESTS_EMAIL='{service_admin_user.email_address}'
export API_CLIENT_INTEGRATION_TESTS_NUMBER=07700900501
export API_CLIENT_INTEGRATION_TESTS_EMAIL_TEMPLATE_ID={template4_id}
export API_CLIENT_INTEGRATION_TESTS_SMS_TEMPLATE_ID={template5_id}
export API_CLIENT_INTEGRATION_TESTS_LETTER_TEMPLATE_ID={template6_id}
export API_CLIENT_INTEGRATION_TESTS_EMAIL_REPLY_TO_ID=rand-c52f-4648-abb6-tba
export API_CLIENT_INTEGRATION_TESTS_SMS_SENDER_ID=tba-c52f-4648-abb6-tba
export API_CLIENT_INTEGRATION_TESTS_NOTIFY_API_URL={current_app.config['API_HOST_NAME']}
export API_CLIENT_INTEGRATION_TESTS_TEST_API_KEY='{function_tests_live_key_name}-{service.id}-{api_key_live_key.secret}'
export API_CLIENT_INTEGRATION_TESTS_TEAM_API_KEY='{function_tests_live_key_name}-{service.id}-{api_key_live_key.secret}'
export API_CLIENT_INTEGRATION_TESTS_INBOUND_SMS_API_KEY='{function_tests_live_key_name}-a-{api_key_live_key.secret}'


"""

if functional_test_env_file != "":
Expand Down Expand Up @@ -337,8 +367,7 @@ def _create_inbound_numbers(service_id, user_id, number="07700900500", provider=
return inbound_number.id


def _create_email_template(service, user_id):
name = "Functional Tests - CSV Email Template with Build ID"
def _create_email_template(service, user_id, name, subject, content):

templates = dao_get_all_templates_for_service(service_id=service.id)

Expand All @@ -349,8 +378,8 @@ def _create_email_template(service, user_id):
data = {
"name": name,
"template_type": "email",
"content": "The quick brown fox jumped over the lazy dog. Build id: ((build_id)).",
"subject": "Functional Tests - CSV Email",
"content": content,
"subject": subject,
"created_by": user_id,
}

Expand All @@ -363,8 +392,7 @@ def _create_email_template(service, user_id):
return new_template.id


def _create_sms_template(service, user_id):
name = "Functional Tests - CSV SMS Template with Build ID"
def _create_sms_template(service, user_id, name, content):

templates = dao_get_all_templates_for_service(service_id=service.id)

Expand All @@ -373,9 +401,9 @@ def _create_sms_template(service, user_id):
return template.id

data = {
"name": "Functional Tests - CSV SMS Template with Build ID",
"name": name,
"template_type": "sms",
"content": "The quick brown fox jumped over the lazy dog. Build id: ((build_id)).",
"content": content,
"created_by": user_id,
}

Expand All @@ -388,9 +416,7 @@ def _create_sms_template(service, user_id):
return new_template.id


def _create_letter_template(service, user_id):

name = "Functional Tests - CSV Letter Template with Build ID"
def _create_letter_template(service, user_id, name, subject, content):

templates = dao_get_all_templates_for_service(service_id=service.id)

Expand All @@ -399,10 +425,10 @@ def _create_letter_template(service, user_id):
return template.id

data = {
"name": "Functional Tests - CSV Letter Template with Build ID",
"name": name,
"template_type": "letter",
"content": "The quick brown fox jumped over the lazy dog. Build id: ((build_id)).",
"subject": "Functional Tests - CSV Letter",
"content": content,
"subject": subject,
"created_by": user_id,
}

Expand Down