diff --git a/app/celery/research_mode_tasks.py b/app/celery/research_mode_tasks.py index f04b445db7..3c1caff6dd 100644 --- a/app/celery/research_mode_tasks.py +++ b/app/celery/research_mode_tasks.py @@ -231,7 +231,7 @@ def ses_notification_callback(reference): "processingTimeMillis": 2003, "recipients": ["success@simulator.amazonses.com"], "remoteMtaIp": "123.123.123.123", - "reportingMTA": "a7-32.smtp-out.eu-west-1.amazonses.com", + "reportingMTA": "a7-32.smtp-out.eu-west-2.amazonses.com", "smtpResponse": "250 2.6.0 Message received", "timestamp": uniform_timestamp, }, @@ -256,7 +256,7 @@ def ses_notification_callback(reference): "messageId": reference, "sendingAccountId": "12341234", "source": '"TEST" ', - "sourceArn": "arn:aws:ses:eu-west-1:12341234:identity/notify.works", + "sourceArn": "arn:aws:ses:eu-west-2:12341234:identity/notify.works", "sourceIp": "0.0.0.1", "timestamp": uniform_timestamp, }, @@ -266,14 +266,14 @@ def ses_notification_callback(reference): return { "Type": "Notification", "MessageId": "8e83c020-1234-1234-1234-92a8ee9baa0a", - "TopicArn": "arn:aws:sns:eu-west-1:12341234:ses_notifications", + "TopicArn": "arn:aws:sns:eu-west-2:12341234:ses_notifications", "Subject": None, "Message": json.dumps(ses_message_body), "Timestamp": uniform_timestamp, "SignatureVersion": "1", "Signature": "[REDACTED]", - "SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-[REDACTED].pem", - "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=[REACTED]", + "SigningCertUrl": "https://sns.eu-west-2.amazonaws.com/SimpleNotificationService-[REDACTED].pem", + "UnsubscribeUrl": "https://sns.eu-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=[REACTED]", "MessageAttributes": {}, } @@ -302,7 +302,7 @@ def _ses_bounce_callback(reference, bounce_type): ], "feedbackId": "0102015fc9e676fb-12341234-1234-1234-1234-9301e86a4fa8-000000", "remoteMtaIp": "123.123.123.123", - "reportingMTA": "dsn; a7-31.smtp-out.eu-west-1.amazonses.com", + "reportingMTA": "dsn; a7-31.smtp-out.eu-west-2.amazonses.com", "timestamp": uniform_timestamp, }, "mail": { @@ -326,7 +326,7 @@ def _ses_bounce_callback(reference, bounce_type): "messageId": reference, "sendingAccountId": "12341234", "source": '"TEST" ', - "sourceArn": "arn:aws:ses:eu-west-1:12341234:identity/notify.works", + "sourceArn": "arn:aws:ses:eu-west-2:12341234:identity/notify.works", "sourceIp": "0.0.0.1", "timestamp": uniform_timestamp, }, @@ -335,13 +335,13 @@ def _ses_bounce_callback(reference, bounce_type): return { "Type": "Notification", "MessageId": "36e67c28-1234-1234-1234-2ea0172aa4a7", - "TopicArn": "arn:aws:sns:eu-west-1:12341234:ses_notifications", + "TopicArn": "arn:aws:sns:eu-west-2:12341234:ses_notifications", "Subject": None, "Message": json.dumps(ses_message_body), "Timestamp": uniform_timestamp, "SignatureVersion": "1", "Signature": "[REDACTED]", - "SigningCertUrl": "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-[REDACTED]].pem", - "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=[REDACTED]]", + "SigningCertUrl": "https://sns.eu-west-2.amazonaws.com/SimpleNotificationService-[REDACTED]].pem", + "UnsubscribeUrl": "https://sns.eu-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=[REDACTED]]", "MessageAttributes": {}, } diff --git a/app/config.py b/app/config.py index a6ed94e7a0..7cb49b41ec 100644 --- a/app/config.py +++ b/app/config.py @@ -178,7 +178,7 @@ class Config: ########################### NOTIFY_ENVIRONMENT = os.environ.get("NOTIFY_ENVIRONMENT", "development") - AWS_REGION = "eu-west-1" + AWS_REGION = "eu-west-2" INVITATION_EXPIRATION_DAYS = 2 NOTIFY_APP_NAME = "api" @@ -267,7 +267,7 @@ class Config: AWS_ACCOUNT_ID = os.environ.get("AWS_ACCOUNT_ID", "123456789012") CELERY = { - "broker_url": "https://sqs.eu-west-1.amazonaws.com", + "broker_url": "https://sqs.eu-west-2.amazonaws.com", "broker_transport": "sqs", "task_ignore_result": True, "broker_transport_options": { diff --git a/tests/app/celery/test_letters_pdf_tasks.py b/tests/app/celery/test_letters_pdf_tasks.py index 6498bf0485..e2dde33ce0 100644 --- a/tests/app/celery/test_letters_pdf_tasks.py +++ b/tests/app/celery/test_letters_pdf_tasks.py @@ -591,19 +591,19 @@ def test_process_sanitised_letter_with_valid_letter( scan_bucket_name = current_app.config["S3_BUCKET_LETTERS_SCAN"] template_preview_bucket_name = current_app.config["S3_BUCKET_LETTER_SANITISE"] destination_bucket_name = current_app.config[destination_bucket] - conn = boto3.resource("s3", region_name="eu-west-1") + conn = boto3.resource("s3", region_name="eu-west-2") scan_bucket = conn.create_bucket( - Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) template_preview_bucket = conn.create_bucket( - Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) destination_bucket = conn.create_bucket( - Bucket=destination_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=destination_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=scan_bucket_name, Key=filename, Body=b"original_pdf_content") s3.put_object(Bucket=template_preview_bucket_name, Key=filename, Body=b"sanitised_pdf_content") @@ -656,14 +656,14 @@ def test_process_sanitised_letter_sets_postage_international( scan_bucket_name = current_app.config["S3_BUCKET_LETTERS_SCAN"] template_preview_bucket_name = current_app.config["S3_BUCKET_LETTER_SANITISE"] destination_bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - conn = boto3.resource("s3", region_name="eu-west-1") - conn.create_bucket(Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + conn = boto3.resource("s3", region_name="eu-west-2") + conn.create_bucket(Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) conn.create_bucket( - Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) - conn.create_bucket(Bucket=destination_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + conn.create_bucket(Bucket=destination_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=scan_bucket_name, Key=filename, Body=b"original_pdf_content") s3.put_object(Bucket=template_preview_bucket_name, Key=filename, Body=b"sanitised_pdf_content") @@ -699,19 +699,19 @@ def test_process_sanitised_letter_with_invalid_letter(sample_letter_notification scan_bucket_name = current_app.config["S3_BUCKET_LETTERS_SCAN"] template_preview_bucket_name = current_app.config["S3_BUCKET_LETTER_SANITISE"] invalid_letter_bucket_name = current_app.config["S3_BUCKET_INVALID_PDF"] - conn = boto3.resource("s3", region_name="eu-west-1") + conn = boto3.resource("s3", region_name="eu-west-2") scan_bucket = conn.create_bucket( - Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=scan_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) template_preview_bucket = conn.create_bucket( - Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=template_preview_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) invalid_letter_bucket = conn.create_bucket( - Bucket=invalid_letter_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=invalid_letter_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=scan_bucket_name, Key=filename, Body=b"original_pdf_content") sample_letter_notification.status = NOTIFICATION_PENDING_VIRUS_CHECK diff --git a/tests/app/celery/test_nightly_tasks.py b/tests/app/celery/test_nightly_tasks.py index ae59deb6d8..2e6719688f 100644 --- a/tests/app/celery/test_nightly_tasks.py +++ b/tests/app/celery/test_nightly_tasks.py @@ -1120,7 +1120,7 @@ def test_deep_archive_notification_history_hour_starting_happy_path( set_config(notify_api, "NOTIFICATION_DEEP_HISTORY_DELETE_ARCHIVED", delete_archived), ): s3 = boto3.client("s3") - s3.create_bucket(Bucket="deep-bucket", CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket="deep-bucket", CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) _populate_notification_history(sample_template, sample_job) @@ -1336,7 +1336,7 @@ def test_deep_archive_notification_history_hour_starting_delete_fails( db.engine.connect() as alt_conn, ): s3 = boto3.client("s3") - s3.create_bucket(Bucket="deep-bucket", CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket="deep-bucket", CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) _populate_notification_history(sample_template, sample_job) diff --git a/tests/app/celery/test_provider_tasks.py b/tests/app/celery/test_provider_tasks.py index 1a6d20be8e..e323895926 100644 --- a/tests/app/celery/test_provider_tasks.py +++ b/tests/app/celery/test_provider_tasks.py @@ -252,8 +252,8 @@ def test_deliver_letter( sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) s3.put_object(Bucket=pdf_bucket, Key="2020-02-17/NOTIFY.REF1.D.2.C.20200217150000.PDF", Body=b"file") deliver_letter(letter.id) @@ -297,8 +297,8 @@ def test_deliver_letter_when_file_is_not_in_S3_logs_an_error(mocker, sample_lett sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) with pytest.raises(NotificationTechnicalFailureException) as e: deliver_letter(letter.id) @@ -343,8 +343,8 @@ def test_deliver_letter_retries_when_there_is_a_retryable_exception( sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) s3.put_object(Bucket=pdf_bucket, Key="2020-02-17/NOTIFY.REF1.D.2.C.20200217150000.PDF", Body=b"file") with caplog.at_level("WARNING"): @@ -388,8 +388,8 @@ def test_deliver_letter_logs_a_warning_when_the_print_request_is_duplicate( sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) s3.put_object(Bucket=pdf_bucket, Key="2020-02-17/NOTIFY.REF1.D.2.C.20200217150000.PDF", Body=b"file") with caplog.at_level("WARNING"): @@ -468,8 +468,8 @@ def test_deliver_letter_when_there_is_a_non_retryable_error( sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) s3.put_object(Bucket=pdf_bucket, Key="2020-02-17/NOTIFY.REF1.D.2.C.20200217150000.PDF", Body=b"file") with pytest.raises(NotificationTechnicalFailureException) as e: @@ -505,8 +505,8 @@ def test_deliver_letter_when_max_retries_are_reached(mocker, sample_letter_templ sample_letter_template.service.organisation = sample_organisation pdf_bucket = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=pdf_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) s3.put_object(Bucket=pdf_bucket, Key="2020-02-17/NOTIFY.REF1.D.2.C.20200217150000.PDF", Body=b"file") with pytest.raises(NotificationTechnicalFailureException) as e: diff --git a/tests/app/clients/test_dvla.py b/tests/app/clients/test_dvla.py index c885fb1870..f4df7c4f66 100644 --- a/tests/app/clients/test_dvla.py +++ b/tests/app/clients/test_dvla.py @@ -33,7 +33,7 @@ @pytest.fixture def ssm(): with mock_aws(): - ssm_client = boto3.client("ssm", "eu-west-1") + ssm_client = boto3.client("ssm", "eu-west-2") ssm_client.put_parameter( Name="/notify/api/dvla_username", Value="some username", diff --git a/tests/app/dao/notification_dao/test_notification_dao_delete_notifications.py b/tests/app/dao/notification_dao/test_notification_dao_delete_notifications.py index 3370e5136f..b19705614a 100644 --- a/tests/app/dao/notification_dao/test_notification_dao_delete_notifications.py +++ b/tests/app/dao/notification_dao/test_notification_dao_delete_notifications.py @@ -33,9 +33,9 @@ def test_every_column_in_notification_history_is_filled_with_data_from_notificat @mock_aws @freeze_time("2019-09-01 04:30") def test_move_notifications_deletes_letters_from_s3(sample_letter_template): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) eight_days_ago = datetime.utcnow() - timedelta(days=8) create_notification( @@ -59,9 +59,9 @@ def test_move_notifications_deletes_letters_from_s3(sample_letter_template): @mock_aws @freeze_time("2019-09-01 04:30") def test_move_notifications_deletes_same_letter_from_s3_as_notifications(sample_letter_template): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) noti_a_timestamp = datetime.utcnow() - timedelta(days=8) noti_b_timestamp = datetime.utcnow() - timedelta(days=8, seconds=1) @@ -103,10 +103,10 @@ def test_move_notifications_deletes_same_letter_from_s3_as_notifications(sample_ @mock_aws @freeze_time("2019-09-01 04:30") def test_move_notifications_copes_if_letter_not_in_s3(sample_letter_template): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.create_bucket( Bucket=current_app.config["S3_BUCKET_LETTERS_PDF"], - CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}, + CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}, ) eight_days_ago = datetime.utcnow() - timedelta(days=8) @@ -165,8 +165,8 @@ def test_move_notifications_deletes_letters_sent_and_in_final_state_from_table_a sample_service, notification_status ): bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) letter_template = create_template(service=sample_service, template_type="letter") eight_days_ago = datetime.utcnow() - timedelta(days=8) @@ -198,8 +198,8 @@ def test_move_notifications_deletes_letters_sent_and_in_final_state_from_table_a @freeze_time("2020-12-24 04:30") def test_move_notifications_deletes_letters_that_failed_validation_from_table_and_s3_invalid_bucket(sample_service): bucket_name = current_app.config["S3_BUCKET_INVALID_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) letter_template = create_template(service=sample_service, template_type="letter") eight_days_ago = datetime.utcnow() - timedelta(days=8) @@ -350,9 +350,9 @@ def test_delete_test_notifications(sample_template, sample_email_template): @mock_aws @freeze_time("2024-09-01 04:30") def test_delete_test_notifications_deletes_letters_from_s3(sample_letter_template): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") bucket_name = current_app.config["S3_BUCKET_TEST_LETTERS"] - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) eight_days_ago = datetime.utcnow() - timedelta(days=8) create_notification( @@ -376,9 +376,9 @@ def test_delete_test_notifications_deletes_letters_from_s3(sample_letter_templat @mock_aws @freeze_time("2019-09-01 04:30") def test_delete_test_notifications_deletes_same_letter_from_s3_as_notifications(sample_letter_template): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") bucket_name = current_app.config["S3_BUCKET_TEST_LETTERS"] - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) noti_a_timestamp = datetime.utcnow() - timedelta(days=8) noti_b_timestamp = datetime.utcnow() - timedelta(days=8, seconds=1) @@ -422,10 +422,10 @@ def test_delete_test_notifications_deletes_same_letter_from_s3_as_notifications( @mock_aws @freeze_time("2019-09-01 04:30") def test_delete_test_notifications_copes_if_letter_not_in_s3(sample_letter_template, caplog): - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.create_bucket( Bucket=current_app.config["S3_BUCKET_TEST_LETTERS"], - CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}, + CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}, ) eight_days_ago = datetime.utcnow() - timedelta(days=8) diff --git a/tests/app/db.py b/tests/app/db.py index 22b2da1262..12542af36a 100644 --- a/tests/app/db.py +++ b/tests/app/db.py @@ -819,7 +819,7 @@ def ses_complaint_callback_malformed_message_id(): "SignatureVersion": "1", "MessageAttributes": {}, "MessageId": "98c6e927-af5d-5f3b-9522-bab736f2cbde", - "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com", + "UnsubscribeUrl": "https://sns.eu-west-2.amazonaws.com", "TopicArn": "arn:ses_notifications", "Type": "Notification", "Timestamp": "2018-06-05T14:00:15.952Z", @@ -838,7 +838,7 @@ def ses_complaint_callback_with_missing_complaint_type(): "SignatureVersion": "1", "MessageAttributes": {}, "MessageId": "98c6e927-af5d-5f3b-9522-bab736f2cbde", - "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com", + "UnsubscribeUrl": "https://sns.eu-west-2.amazonaws.com", "TopicArn": "arn:ses_notifications", "Type": "Notification", "Timestamp": "2018-06-05T14:00:15.952Z", @@ -857,7 +857,7 @@ def ses_complaint_callback(): "SignatureVersion": "1", "MessageAttributes": {}, "MessageId": "98c6e927-af5d-5f3b-9522-bab736f2cbde", - "UnsubscribeUrl": "https://sns.eu-west-1.amazonaws.com", + "UnsubscribeUrl": "https://sns.eu-west-2.amazonaws.com", "TopicArn": "arn:ses_notifications", "Type": "Notification", "Timestamp": "2018-06-05T14:00:15.952Z", @@ -870,11 +870,11 @@ def ses_complaint_callback(): def ses_notification_callback(): return ( '{\n "Type" : "Notification",\n "MessageId" : "ref1",' - '\n "TopicArn" : "arn:aws:sns:eu-west-1:123456789012:testing",' + '\n "TopicArn" : "arn:aws:sns:eu-west-2:123456789012:testing",' '\n "Message" : "{\\"notificationType\\":\\"Delivery\\",' '\\"mail\\":{\\"timestamp\\":\\"2016-03-14T12:35:25.909Z\\",' '\\"source\\":\\"test@test-domain.com\\",' - '\\"sourceArn\\":\\"arn:aws:ses:eu-west-1:123456789012:identity/testing-notify\\",' + '\\"sourceArn\\":\\"arn:aws:ses:eu-west-2:123456789012:identity/testing-notify\\",' '\\"sendingAccountId\\":\\"123456789012\\",' '\\"messageId\\":\\"ref1\\",' '\\"destination\\":[\\"testing@digital.cabinet-office.gov.uk\\"]},' @@ -882,16 +882,16 @@ def ses_notification_callback(): '\\"processingTimeMillis\\":658,' '\\"recipients\\":[\\"testing@digital.cabinet-office.gov.uk\\"],' '\\"smtpResponse\\":\\"250 2.0.0 OK 1457958926 uo5si26480932wjc.221 - gsmtp\\",' - '\\"reportingMTA\\":\\"a6-238.smtp-out.eu-west-1.amazonses.com\\"}}",' + '\\"reportingMTA\\":\\"a6-238.smtp-out.eu-west-2.amazonses.com\\"}}",' '\n "Timestamp" : "2016-03-14T12:35:26.665Z",\n "SignatureVersion" : "1",' '\n "Signature" : "X8d7eTAOZ6wlnrdVVPYanrAlsX0SMPfOzhoTEBnQqYkrNWTqQY91C0f3bxtPdUhUt' "OowyPAOkTQ4KnZuzphfhVb2p1MyVYMxNKcBFB05/qaCX99+92fjw4x9LeUOwyGwMv5F0Vkfi5qZCcEw69uVrhYL" "VSTFTrzi/yCtru+yFULMQ6UhbY09GwiP6hjxZMVr8aROQy5lLHglqQzOuSZ4KeD85JjifHdKzlx8jjQ+uj+FLzHXPMA" 'PmPU1JK9kpoHZ1oPshAFgPDpphJe+HwcJ8ezmk+3AEUr3wWli3xF+49y8Z2anASSVp6YI2YP95UT8Rlh3qT3T+V9V8rbSVislxA==",' - '\n "SigningCertURL" : "https://sns.eu-west-1.amazonaws.com/SimpleNotificationService-bb750' + '\n "SigningCertURL" : "https://sns.eu-west-2.amazonaws.com/SimpleNotificationService-bb750' 'dd426d95ee9390147a5624348ee.pem",' - '\n "UnsubscribeURL" : "https://sns.eu-west-1.amazonaws.com/?Action=Unsubscribe&S' - 'subscriptionArn=arn:aws:sns:eu-west-1:302763885840:preview-emails:d6aad3ef-83d6-4cf3-a470-54e2e75916da"\n}' + '\n "UnsubscribeURL" : "https://sns.eu-west-2.amazonaws.com/?Action=Unsubscribe&S' + 'subscriptionArn=arn:aws:sns:eu-west-2:302763885840:preview-emails:d6aad3ef-83d6-4cf3-a470-54e2e75916da"\n}' ) diff --git a/tests/app/functional_test_fixtures/test_functional_test_fixtures.py b/tests/app/functional_test_fixtures/test_functional_test_fixtures.py index 8e68ab070d..4867d307e5 100644 --- a/tests/app/functional_test_fixtures/test_functional_test_fixtures.py +++ b/tests/app/functional_test_fixtures/test_functional_test_fixtures.py @@ -185,8 +185,8 @@ def test_function_test_fixtures_uploads_to_ssm(notify_api, os_environ, mocker): os.environ["SSM_UPLOAD_PATH"] = "/test/ssm/environment" # AWS are changing from AWS_DEFAULT_REGION to AWS_REGION for v2 clients. Set both for now. - os.environ["AWS_REGION"] = "eu-west-1" - os.environ["AWS_DEFAULT_REGION"] = "eu-west-1" + os.environ["AWS_REGION"] = "eu-west-2" + os.environ["AWS_DEFAULT_REGION"] = "eu-west-2" apply_fixtures() diff --git a/tests/app/letters/test_letter_utils.py b/tests/app/letters/test_letter_utils.py index bd00b74e09..ec4f439e57 100644 --- a/tests/app/letters/test_letter_utils.py +++ b/tests/app/letters/test_letter_utils.py @@ -55,8 +55,8 @@ def _sample_precompiled_letter_notification_using_test_key(sample_precompiled_le @mock_aws def test_find_letter_pdf_in_s3_returns_object(sample_notification): bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) _, prefix = get_bucket_name_and_prefix_for_notification(sample_notification) s3.put_object(Bucket=bucket_name, Key=f"{prefix}-and-then-some", Body=b"f") @@ -67,8 +67,8 @@ def test_find_letter_pdf_in_s3_returns_object(sample_notification): @mock_aws def test_find_letter_pdf_in_s3_raises_if_not_found(sample_notification): bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) with pytest.raises(LetterPDFNotFound): find_letter_pdf_in_s3(sample_notification) @@ -209,9 +209,9 @@ def test_get_letter_pdf_gets_pdf_from_correct_bucket( bucket_name = current_app.config[bucket_config_name] filename = datetime.utcnow().strftime(filename_format) - conn = boto3.resource("s3", region_name="eu-west-1") - conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) - s3 = boto3.client("s3", region_name="eu-west-1") + conn = boto3.resource("s3", region_name="eu-west-2") + conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=bucket_name, Key=filename, Body=b"pdf_content") file_data, metadata = get_letter_pdf_and_metadata(sample_precompiled_letter_notification_using_test_key) @@ -275,10 +275,10 @@ def test_move_failed_pdf_error(notify_api): filename = "test.pdf" bucket_name = current_app.config["S3_BUCKET_LETTERS_SCAN"] - conn = boto3.resource("s3", region_name="eu-west-1") - bucket = conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + conn = boto3.resource("s3", region_name="eu-west-2") + bucket = conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=bucket_name, Key=filename, Body=b"pdf_content") move_failed_pdf(filename, ScanErrorType.ERROR) @@ -293,10 +293,10 @@ def test_move_failed_pdf_scan_failed(notify_api): filename = "test.pdf" bucket_name = current_app.config["S3_BUCKET_LETTERS_SCAN"] - conn = boto3.resource("s3", region_name="eu-west-1") - bucket = conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + conn = boto3.resource("s3", region_name="eu-west-2") + bucket = conn.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=bucket_name, Key=filename, Body=b"pdf_content") move_failed_pdf(filename, ScanErrorType.FAILURE) @@ -334,15 +334,15 @@ def test_move_sanitised_letter_to_live_pdf_bucket(notify_api): source_bucket_name = current_app.config["S3_BUCKET_LETTER_SANITISE"] target_bucket_name = current_app.config["S3_BUCKET_LETTERS_PDF"] - conn = boto3.resource("s3", region_name="eu-west-1") + conn = boto3.resource("s3", region_name="eu-west-2") source_bucket = conn.create_bucket( - Bucket=source_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=source_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) target_bucket = conn.create_bucket( - Bucket=target_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=target_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=source_bucket_name, Key=filename, Body=b"pdf_content") move_sanitised_letter_to_test_or_live_pdf_bucket( @@ -359,15 +359,15 @@ def test_move_sanitised_letter_to_test_pdf_bucket(notify_api): source_bucket_name = current_app.config["S3_BUCKET_LETTER_SANITISE"] target_bucket_name = current_app.config["S3_BUCKET_TEST_LETTERS"] - conn = boto3.resource("s3", region_name="eu-west-1") + conn = boto3.resource("s3", region_name="eu-west-2") source_bucket = conn.create_bucket( - Bucket=source_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=source_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) target_bucket = conn.create_bucket( - Bucket=target_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"} + Bucket=target_bucket_name, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"} ) - s3 = boto3.client("s3", region_name="eu-west-1") + s3 = boto3.client("s3", region_name="eu-west-2") s3.put_object(Bucket=source_bucket_name, Key=filename, Body=b"pdf_content") move_sanitised_letter_to_test_or_live_pdf_bucket( diff --git a/tests/app/report_requests/test_process_notifications_report.py b/tests/app/report_requests/test_process_notifications_report.py index 083d6afd06..b544c05f3f 100644 --- a/tests/app/report_requests/test_process_notifications_report.py +++ b/tests/app/report_requests/test_process_notifications_report.py @@ -127,8 +127,8 @@ def mock_service( ) report_bucket = current_app.config.get("S3_BUCKET_REPORT_REQUESTS_DOWNLOAD") - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) return service @@ -460,8 +460,8 @@ def test_process_report_request_should_return_correct_rows( } report_bucket = current_app.config.get("S3_BUCKET_REPORT_REQUESTS_DOWNLOAD") - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) report_request = ReportRequest( user_id=sample_user.id, @@ -571,8 +571,8 @@ def test_process_report_request_should_contain_job_notification( } report_bucket = current_app.config.get("S3_BUCKET_REPORT_REQUESTS_DOWNLOAD") - s3 = boto3.client("s3", region_name="eu-west-1") - s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-1"}) + s3 = boto3.client("s3", region_name="eu-west-2") + s3.create_bucket(Bucket=report_bucket, CreateBucketConfiguration={"LocationConstraint": "eu-west-2"}) report_request = ReportRequest( user_id=sample_user.id, diff --git a/tests/app/test_config.py b/tests/app/test_config.py index 9ba4fd87e4..3be86c89ed 100644 --- a/tests/app/test_config.py +++ b/tests/app/test_config.py @@ -34,7 +34,7 @@ def test_queue_names_all_queues_correct(): def test_predefined_queues(): prefix = "test-prefix-" - aws_region = "eu-west-1" + aws_region = "eu-west-2" aws_account_id = "123456789012" class_queues = [