diff --git a/src/registrar/config/settings.py b/src/registrar/config/settings.py index 8e1d4411f..9d606221c 100644 --- a/src/registrar/config/settings.py +++ b/src/registrar/config/settings.py @@ -216,6 +216,7 @@ AUTH_USER_MODEL = "registrar.User" # Configuration for accessing AWS SES AWS_ACCESS_KEY_ID = env.str("AWS_ACCESS_KEY_ID", None) AWS_SECRET_ACCESS_KEY = env.str("AWS_SECRET_ACCESS_KEY", None) +AWS_REGION="us-gov-west-1" # email address to use for various automated correspondence # TODO: pick something sensible here diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index a2e76dea2..868585cc8 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -78,32 +78,12 @@ class TestDomainApplication(TestCase): """Create an application and submit it and see if email was sent.""" user, _ = User.objects.get_or_create() contact = Contact.objects.create(email="test@test.gov") - com_website, _ = Website.objects.get_or_create(website="igorville.com") - gov_website, _ = Website.objects.get_or_create(website="igorville.gov") domain, _ = Domain.objects.get_or_create(name="igorville.gov") - domain.save() application = DomainApplication.objects.create( creator=user, - investigator=user, - organization_type=DomainApplication.OrganizationChoices.FEDERAL, - federal_type=DomainApplication.BranchChoices.EXECUTIVE, - is_election_board=False, - organization_name="Test", - address_line1="100 Main St.", - address_line2="APT 1A", - state_territory="CA", - zipcode="12345-6789", - authorizing_official=contact, requested_domain=domain, submitter=contact, - purpose="Igorville rules!", - security_email="security@igorville.gov", - anything_else="All of Igorville loves the dotgov program.", - is_policy_acknowledged=True, ) - application.current_websites.add(com_website) - application.alternative_domains.add(gov_website) - application.other_contacts.add(contact) application.save() application.submit() diff --git a/src/registrar/tests/test_views.py b/src/registrar/tests/test_views.py index b40fcc2dc..062f48a1a 100644 --- a/src/registrar/tests/test_views.py +++ b/src/registrar/tests/test_views.py @@ -6,6 +6,7 @@ from django.urls import reverse from django.contrib.auth import get_user_model from django_webtest import WebTest # type: ignore +import boto3_mocking from registrar.models import DomainApplication, Domain, Contact, Website from registrar.views.application import ApplicationWizard, Step @@ -115,6 +116,7 @@ class DomainApplicationTests(TestWithUser, WebTest): "What kind of U.S.-based government organization do you represent?", result ) + @boto3_mocking.patching def test_application_form_submission(self): """Can fill out the entire form and submit. As we add additional form pages, we need to include them here to make diff --git a/src/registrar/utility/email.py b/src/registrar/utility/email.py index 5b797e245..e3489fe86 100644 --- a/src/registrar/utility/email.py +++ b/src/registrar/utility/email.py @@ -18,8 +18,10 @@ def send_templated_email(template_name: str, to_address: str, context={}): ses_client = boto3.client( "sesv2", + region_name=settings.AWS_REGION, aws_access_key_id=settings.AWS_ACCESS_KEY_ID, aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY, + ) ses_client.send_email( FromEmailAddress=settings.DEFAULT_FROM_EMAIL,