feat: add update_receipt_rule to ses mock (#4490)
This commit is contained in:
parent
e24d337dcf
commit
940b351387
@ -1087,7 +1087,6 @@
|
|||||||
- [ ] bundle_instance
|
- [ ] bundle_instance
|
||||||
- [ ] cancel_bundle_task
|
- [ ] cancel_bundle_task
|
||||||
- [ ] cancel_capacity_reservation
|
- [ ] cancel_capacity_reservation
|
||||||
- [ ] cancel_capacity_reservation_fleets
|
|
||||||
- [ ] cancel_conversion_task
|
- [ ] cancel_conversion_task
|
||||||
- [ ] cancel_export_task
|
- [ ] cancel_export_task
|
||||||
- [ ] cancel_import_task
|
- [ ] cancel_import_task
|
||||||
@ -1099,7 +1098,6 @@
|
|||||||
- [X] copy_image
|
- [X] copy_image
|
||||||
- [X] copy_snapshot
|
- [X] copy_snapshot
|
||||||
- [ ] create_capacity_reservation
|
- [ ] create_capacity_reservation
|
||||||
- [ ] create_capacity_reservation_fleet
|
|
||||||
- [X] create_carrier_gateway
|
- [X] create_carrier_gateway
|
||||||
- [ ] create_client_vpn_endpoint
|
- [ ] create_client_vpn_endpoint
|
||||||
- [ ] create_client_vpn_route
|
- [ ] create_client_vpn_route
|
||||||
@ -1231,7 +1229,6 @@
|
|||||||
- [X] describe_availability_zones
|
- [X] describe_availability_zones
|
||||||
- [ ] describe_bundle_tasks
|
- [ ] describe_bundle_tasks
|
||||||
- [ ] describe_byoip_cidrs
|
- [ ] describe_byoip_cidrs
|
||||||
- [ ] describe_capacity_reservation_fleets
|
|
||||||
- [ ] describe_capacity_reservations
|
- [ ] describe_capacity_reservations
|
||||||
- [X] describe_carrier_gateways
|
- [X] describe_carrier_gateways
|
||||||
- [ ] describe_classic_link_instances
|
- [ ] describe_classic_link_instances
|
||||||
@ -1411,8 +1408,6 @@
|
|||||||
- [ ] get_transit_gateway_prefix_list_references
|
- [ ] get_transit_gateway_prefix_list_references
|
||||||
- [ ] get_transit_gateway_route_table_associations
|
- [ ] get_transit_gateway_route_table_associations
|
||||||
- [ ] get_transit_gateway_route_table_propagations
|
- [ ] get_transit_gateway_route_table_propagations
|
||||||
- [ ] get_vpn_connection_device_sample_configuration
|
|
||||||
- [ ] get_vpn_connection_device_types
|
|
||||||
- [ ] import_client_vpn_client_certificate_revocation_list
|
- [ ] import_client_vpn_client_certificate_revocation_list
|
||||||
- [ ] import_image
|
- [ ] import_image
|
||||||
- [ ] import_instance
|
- [ ] import_instance
|
||||||
@ -1422,7 +1417,6 @@
|
|||||||
- [ ] modify_address_attribute
|
- [ ] modify_address_attribute
|
||||||
- [ ] modify_availability_zone_group
|
- [ ] modify_availability_zone_group
|
||||||
- [ ] modify_capacity_reservation
|
- [ ] modify_capacity_reservation
|
||||||
- [ ] modify_capacity_reservation_fleet
|
|
||||||
- [ ] modify_client_vpn_endpoint
|
- [ ] modify_client_vpn_endpoint
|
||||||
- [ ] modify_default_credit_specification
|
- [ ] modify_default_credit_specification
|
||||||
- [ ] modify_ebs_default_kms_key_id
|
- [ ] modify_ebs_default_kms_key_id
|
||||||
@ -1535,7 +1529,7 @@
|
|||||||
|
|
||||||
## ecr
|
## ecr
|
||||||
<details>
|
<details>
|
||||||
<summary>74% implemented</summary>
|
<summary>76% implemented</summary>
|
||||||
|
|
||||||
- [ ] batch_check_layer_availability
|
- [ ] batch_check_layer_availability
|
||||||
- [X] batch_delete_image
|
- [X] batch_delete_image
|
||||||
@ -1546,7 +1540,6 @@
|
|||||||
- [X] delete_registry_policy
|
- [X] delete_registry_policy
|
||||||
- [X] delete_repository
|
- [X] delete_repository
|
||||||
- [X] delete_repository_policy
|
- [X] delete_repository_policy
|
||||||
- [ ] describe_image_replication_status
|
|
||||||
- [X] describe_image_scan_findings
|
- [X] describe_image_scan_findings
|
||||||
- [X] describe_images
|
- [X] describe_images
|
||||||
- [X] describe_registry
|
- [X] describe_registry
|
||||||
@ -1667,7 +1660,7 @@
|
|||||||
|
|
||||||
## eks
|
## eks
|
||||||
<details>
|
<details>
|
||||||
<summary>35% implemented</summary>
|
<summary>37% implemented</summary>
|
||||||
|
|
||||||
- [ ] associate_encryption_config
|
- [ ] associate_encryption_config
|
||||||
- [ ] associate_identity_provider_config
|
- [ ] associate_identity_provider_config
|
||||||
@ -1679,7 +1672,6 @@
|
|||||||
- [X] delete_cluster
|
- [X] delete_cluster
|
||||||
- [X] delete_fargate_profile
|
- [X] delete_fargate_profile
|
||||||
- [X] delete_nodegroup
|
- [X] delete_nodegroup
|
||||||
- [ ] deregister_cluster
|
|
||||||
- [ ] describe_addon
|
- [ ] describe_addon
|
||||||
- [ ] describe_addon_versions
|
- [ ] describe_addon_versions
|
||||||
- [X] describe_cluster
|
- [X] describe_cluster
|
||||||
@ -1695,7 +1687,6 @@
|
|||||||
- [X] list_nodegroups
|
- [X] list_nodegroups
|
||||||
- [ ] list_tags_for_resource
|
- [ ] list_tags_for_resource
|
||||||
- [ ] list_updates
|
- [ ] list_updates
|
||||||
- [ ] register_cluster
|
|
||||||
- [ ] tag_resource
|
- [ ] tag_resource
|
||||||
- [ ] untag_resource
|
- [ ] untag_resource
|
||||||
- [ ] update_addon
|
- [ ] update_addon
|
||||||
@ -2614,7 +2605,6 @@
|
|||||||
- [X] list_topic_rules
|
- [X] list_topic_rules
|
||||||
- [ ] list_v2_logging_levels
|
- [ ] list_v2_logging_levels
|
||||||
- [ ] list_violation_events
|
- [ ] list_violation_events
|
||||||
- [ ] put_verification_state_on_violation
|
|
||||||
- [ ] register_ca_certificate
|
- [ ] register_ca_certificate
|
||||||
- [X] register_certificate
|
- [X] register_certificate
|
||||||
- [X] register_certificate_without_ca
|
- [X] register_certificate_without_ca
|
||||||
@ -2990,7 +2980,6 @@
|
|||||||
- [ ] batch_stop
|
- [ ] batch_stop
|
||||||
- [ ] batch_update_schedule
|
- [ ] batch_update_schedule
|
||||||
- [ ] cancel_input_device_transfer
|
- [ ] cancel_input_device_transfer
|
||||||
- [ ] claim_device
|
|
||||||
- [X] create_channel
|
- [X] create_channel
|
||||||
- [X] create_input
|
- [X] create_input
|
||||||
- [ ] create_input_security_group
|
- [ ] create_input_security_group
|
||||||
@ -3808,7 +3797,6 @@
|
|||||||
- [ ] create_presigned_notebook_instance_url
|
- [ ] create_presigned_notebook_instance_url
|
||||||
- [ ] create_processing_job
|
- [ ] create_processing_job
|
||||||
- [ ] create_project
|
- [ ] create_project
|
||||||
- [ ] create_studio_lifecycle_config
|
|
||||||
- [X] create_training_job
|
- [X] create_training_job
|
||||||
- [ ] create_transform_job
|
- [ ] create_transform_job
|
||||||
- [ ] create_trial
|
- [ ] create_trial
|
||||||
@ -3847,7 +3835,6 @@
|
|||||||
- [X] delete_notebook_instance_lifecycle_config
|
- [X] delete_notebook_instance_lifecycle_config
|
||||||
- [ ] delete_pipeline
|
- [ ] delete_pipeline
|
||||||
- [ ] delete_project
|
- [ ] delete_project
|
||||||
- [ ] delete_studio_lifecycle_config
|
|
||||||
- [ ] delete_tags
|
- [ ] delete_tags
|
||||||
- [ ] delete_trial
|
- [ ] delete_trial
|
||||||
- [ ] delete_trial_component
|
- [ ] delete_trial_component
|
||||||
@ -3893,7 +3880,6 @@
|
|||||||
- [ ] describe_pipeline_execution
|
- [ ] describe_pipeline_execution
|
||||||
- [ ] describe_processing_job
|
- [ ] describe_processing_job
|
||||||
- [ ] describe_project
|
- [ ] describe_project
|
||||||
- [ ] describe_studio_lifecycle_config
|
|
||||||
- [ ] describe_subscribed_workteam
|
- [ ] describe_subscribed_workteam
|
||||||
- [X] describe_training_job
|
- [X] describe_training_job
|
||||||
- [ ] describe_transform_job
|
- [ ] describe_transform_job
|
||||||
@ -3952,7 +3938,6 @@
|
|||||||
- [ ] list_pipelines
|
- [ ] list_pipelines
|
||||||
- [ ] list_processing_jobs
|
- [ ] list_processing_jobs
|
||||||
- [ ] list_projects
|
- [ ] list_projects
|
||||||
- [ ] list_studio_lifecycle_configs
|
|
||||||
- [ ] list_subscribed_workteams
|
- [ ] list_subscribed_workteams
|
||||||
- [ ] list_tags
|
- [ ] list_tags
|
||||||
- [X] list_training_jobs
|
- [X] list_training_jobs
|
||||||
@ -3966,7 +3951,6 @@
|
|||||||
- [ ] put_model_package_group_policy
|
- [ ] put_model_package_group_policy
|
||||||
- [ ] register_devices
|
- [ ] register_devices
|
||||||
- [ ] render_ui_template
|
- [ ] render_ui_template
|
||||||
- [ ] retry_pipeline_execution
|
|
||||||
- [ ] search
|
- [ ] search
|
||||||
- [ ] send_pipeline_execution_step_failure
|
- [ ] send_pipeline_execution_step_failure
|
||||||
- [ ] send_pipeline_execution_step_success
|
- [ ] send_pipeline_execution_step_success
|
||||||
@ -4040,7 +4024,7 @@
|
|||||||
|
|
||||||
## ses
|
## ses
|
||||||
<details>
|
<details>
|
||||||
<summary>29% implemented</summary>
|
<summary>30% implemented</summary>
|
||||||
|
|
||||||
- [ ] clone_receipt_rule_set
|
- [ ] clone_receipt_rule_set
|
||||||
- [X] create_configuration_set
|
- [X] create_configuration_set
|
||||||
@ -4107,7 +4091,7 @@
|
|||||||
- [ ] update_configuration_set_sending_enabled
|
- [ ] update_configuration_set_sending_enabled
|
||||||
- [ ] update_configuration_set_tracking_options
|
- [ ] update_configuration_set_tracking_options
|
||||||
- [ ] update_custom_verification_email_template
|
- [ ] update_custom_verification_email_template
|
||||||
- [ ] update_receipt_rule
|
- [X] update_receipt_rule
|
||||||
- [X] update_template
|
- [X] update_template
|
||||||
- [ ] verify_domain_dkim
|
- [ ] verify_domain_dkim
|
||||||
- [ ] verify_domain_identity
|
- [ ] verify_domain_identity
|
||||||
@ -4554,7 +4538,6 @@
|
|||||||
<details>
|
<details>
|
||||||
|
|
||||||
- accessanalyzer
|
- accessanalyzer
|
||||||
- account
|
|
||||||
- acm-pca
|
- acm-pca
|
||||||
- alexaforbusiness
|
- alexaforbusiness
|
||||||
- amp
|
- amp
|
||||||
@ -4581,7 +4564,6 @@
|
|||||||
- chime-sdk-identity
|
- chime-sdk-identity
|
||||||
- chime-sdk-messaging
|
- chime-sdk-messaging
|
||||||
- cloud9
|
- cloud9
|
||||||
- cloudcontrol
|
|
||||||
- clouddirectory
|
- clouddirectory
|
||||||
- cloudfront
|
- cloudfront
|
||||||
- cloudhsm
|
- cloudhsm
|
||||||
@ -4629,7 +4611,6 @@
|
|||||||
- fsx
|
- fsx
|
||||||
- gamelift
|
- gamelift
|
||||||
- globalaccelerator
|
- globalaccelerator
|
||||||
- grafana
|
|
||||||
- greengrass
|
- greengrass
|
||||||
- greengrassv2
|
- greengrassv2
|
||||||
- groundstation
|
- groundstation
|
||||||
@ -4655,7 +4636,6 @@
|
|||||||
- iotwireless
|
- iotwireless
|
||||||
- ivs
|
- ivs
|
||||||
- kafka
|
- kafka
|
||||||
- kafkaconnect
|
|
||||||
- kendra
|
- kendra
|
||||||
- kinesis-video-media
|
- kinesis-video-media
|
||||||
- kinesis-video-signaling
|
- kinesis-video-signaling
|
||||||
@ -4694,10 +4674,8 @@
|
|||||||
- network-firewall
|
- network-firewall
|
||||||
- networkmanager
|
- networkmanager
|
||||||
- nimble
|
- nimble
|
||||||
- opensearch
|
|
||||||
- opsworkscm
|
- opsworkscm
|
||||||
- outposts
|
- outposts
|
||||||
- panorama
|
|
||||||
- personalize
|
- personalize
|
||||||
- personalize-events
|
- personalize-events
|
||||||
- personalize-runtime
|
- personalize-runtime
|
||||||
@ -4752,11 +4730,9 @@
|
|||||||
- timestream-query
|
- timestream-query
|
||||||
- transfer
|
- transfer
|
||||||
- translate
|
- translate
|
||||||
- voice-id
|
|
||||||
- waf
|
- waf
|
||||||
- waf-regional
|
- waf-regional
|
||||||
- wellarchitected
|
- wellarchitected
|
||||||
- wisdom
|
|
||||||
- workdocs
|
- workdocs
|
||||||
- worklink
|
- worklink
|
||||||
- workmail
|
- workmail
|
||||||
|
@ -438,5 +438,18 @@ class SESBackend(BaseBackend):
|
|||||||
else:
|
else:
|
||||||
raise RuleDoesNotExist("Invalid Rule Name.")
|
raise RuleDoesNotExist("Invalid Rule Name.")
|
||||||
|
|
||||||
|
def update_receipt_rule(self, rule_set_name, rule):
|
||||||
|
rule_set = self.receipt_rule_set.get(rule_set_name)
|
||||||
|
|
||||||
|
if rule_set is None:
|
||||||
|
raise RuleSetDoesNotExist(f"Rule set does not exist: {rule_set_name}")
|
||||||
|
|
||||||
|
for i, receipt_rule in enumerate(rule_set):
|
||||||
|
if receipt_rule["name"] == rule["name"]:
|
||||||
|
rule_set[i] = rule
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise RuleDoesNotExist(f"Rule does not exist: {rule['name']}")
|
||||||
|
|
||||||
|
|
||||||
ses_backend = SESBackend()
|
ses_backend = SESBackend()
|
||||||
|
@ -253,6 +253,15 @@ class EmailResponse(BaseResponse):
|
|||||||
template = self.response_template(DESCRIBE_RECEIPT_RULE)
|
template = self.response_template(DESCRIBE_RECEIPT_RULE)
|
||||||
return template.render(rule=rule)
|
return template.render(rule=rule)
|
||||||
|
|
||||||
|
def update_receipt_rule(self):
|
||||||
|
rule_set_name = self._get_param("RuleSetName")
|
||||||
|
rule = self._get_dict_param("Rule.")
|
||||||
|
|
||||||
|
ses_backend.update_receipt_rule(rule_set_name, rule)
|
||||||
|
|
||||||
|
template = self.response_template(UPDATE_RECEIPT_RULE)
|
||||||
|
return template.render()
|
||||||
|
|
||||||
|
|
||||||
VERIFY_EMAIL_IDENTITY = """<VerifyEmailIdentityResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
|
VERIFY_EMAIL_IDENTITY = """<VerifyEmailIdentityResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
|
||||||
<VerifyEmailIdentityResult/>
|
<VerifyEmailIdentityResult/>
|
||||||
@ -549,3 +558,10 @@ DESCRIBE_RECEIPT_RULE = """<DescribeReceiptRuleResponse xmlns="http://ses.amazon
|
|||||||
</ResponseMetadata>
|
</ResponseMetadata>
|
||||||
</DescribeReceiptRuleResponse>
|
</DescribeReceiptRuleResponse>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
UPDATE_RECEIPT_RULE = """<UpdateReceiptRuleResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
|
||||||
|
<UpdateReceiptRuleResult/>
|
||||||
|
<ResponseMetadata>
|
||||||
|
<RequestId>15e0ef1a-9bf2-11e1-9279-01ab88cf109a</RequestId>
|
||||||
|
</ResponseMetadata>
|
||||||
|
</UpdateReceiptRuleResponse>"""
|
||||||
|
@ -2,6 +2,7 @@ import json
|
|||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
from botocore.exceptions import ParamValidationError
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
import pytest
|
import pytest
|
||||||
@ -578,6 +579,318 @@ def test_describe_receipt_rule():
|
|||||||
error.value.response["Error"]["Code"].should.equal("RuleDoesNotExist")
|
error.value.response["Error"]["Code"].should.equal("RuleDoesNotExist")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ses
|
||||||
|
def test_update_receipt_rule():
|
||||||
|
conn = boto3.client("ses", region_name="us-east-1")
|
||||||
|
rule_set_name = "testRuleSet"
|
||||||
|
conn.create_receipt_rule_set(RuleSetName=rule_set_name)
|
||||||
|
|
||||||
|
rule_name = "testRule"
|
||||||
|
conn.create_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": False,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com", "test2@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
update_receipt_rule_response = conn.update_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": True,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
update_receipt_rule_response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||||
|
|
||||||
|
updated_rule_description = conn.describe_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name, RuleName=rule_name
|
||||||
|
)
|
||||||
|
|
||||||
|
updated_rule_description["Rule"]["Name"].should.equal(rule_name)
|
||||||
|
updated_rule_description["Rule"]["Enabled"].should.equal(True)
|
||||||
|
len(updated_rule_description["Rule"]["Recipients"]).should.equal(1)
|
||||||
|
updated_rule_description["Rule"]["Recipients"][0].should.equal("test@email.com")
|
||||||
|
|
||||||
|
len(updated_rule_description["Rule"]["Actions"]).should.equal(1)
|
||||||
|
updated_rule_description["Rule"]["Actions"][0].should.have.key("S3Action")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0].should.have.key("BounceAction")
|
||||||
|
|
||||||
|
with pytest.raises(ClientError) as error:
|
||||||
|
conn.update_receipt_rule(
|
||||||
|
RuleSetName="invalidRuleSetName",
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": True,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
error.value.response["Error"]["Code"].should.equal("RuleSetDoesNotExist")
|
||||||
|
error.value.response["Error"]["Message"].should.equal(
|
||||||
|
"Rule set does not exist: invalidRuleSetName"
|
||||||
|
)
|
||||||
|
|
||||||
|
with pytest.raises(ClientError) as error:
|
||||||
|
conn.update_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": "invalidRuleName",
|
||||||
|
"Enabled": True,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
error.value.response["Error"]["Code"].should.equal("RuleDoesNotExist")
|
||||||
|
error.value.response["Error"]["Message"].should.equal(
|
||||||
|
"Rule does not exist: invalidRuleName"
|
||||||
|
)
|
||||||
|
|
||||||
|
with pytest.raises(ParamValidationError) as error:
|
||||||
|
conn.update_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Enabled": True,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
str(error.value).should.contain(
|
||||||
|
'Parameter validation failed:\nMissing required parameter in Rule: "Name"'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ses
|
||||||
|
def test_update_receipt_rule_actions():
|
||||||
|
conn = boto3.client("ses", region_name="us-east-1")
|
||||||
|
rule_set_name = "testRuleSet"
|
||||||
|
conn.create_receipt_rule_set(RuleSetName=rule_set_name)
|
||||||
|
|
||||||
|
rule_name = "testRule"
|
||||||
|
conn.create_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": False,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com", "test2@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"BucketName": "testBucketName",
|
||||||
|
"ObjectKeyPrefix": "testObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "string",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "string",
|
||||||
|
"SmtpReplyCode": "string",
|
||||||
|
"StatusCode": "string",
|
||||||
|
"Message": "string",
|
||||||
|
"Sender": "string",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
update_receipt_rule_response = conn.update_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": False,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com", "test2@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "newString",
|
||||||
|
"BucketName": "updatedTestBucketName",
|
||||||
|
"ObjectKeyPrefix": "updatedTestObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "newString",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "newString",
|
||||||
|
"SmtpReplyCode": "newString",
|
||||||
|
"StatusCode": "newString",
|
||||||
|
"Message": "newString",
|
||||||
|
"Sender": "newString",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
update_receipt_rule_response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||||
|
|
||||||
|
updated_rule_description = conn.describe_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name, RuleName=rule_name
|
||||||
|
)
|
||||||
|
|
||||||
|
len(updated_rule_description["Rule"]["Actions"]).should.equal(1)
|
||||||
|
updated_rule_description["Rule"]["Actions"][0].should.have.key("S3Action")
|
||||||
|
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["S3Action"].should.have.key(
|
||||||
|
"TopicArn"
|
||||||
|
).being.equal("newString")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["S3Action"].should.have.key(
|
||||||
|
"BucketName"
|
||||||
|
).being.equal("updatedTestBucketName")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["S3Action"].should.have.key(
|
||||||
|
"ObjectKeyPrefix"
|
||||||
|
).being.equal("updatedTestObjectKeyPrefix")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["S3Action"].should.have.key(
|
||||||
|
"KmsKeyArn"
|
||||||
|
).being.equal("newString")
|
||||||
|
|
||||||
|
updated_rule_description["Rule"]["Actions"][0].should.have.key("BounceAction")
|
||||||
|
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["BounceAction"].should.have.key(
|
||||||
|
"TopicArn"
|
||||||
|
).being.equal("newString")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["BounceAction"].should.have.key(
|
||||||
|
"SmtpReplyCode"
|
||||||
|
).being.equal("newString")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["BounceAction"].should.have.key(
|
||||||
|
"StatusCode"
|
||||||
|
).being.equal("newString")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["BounceAction"].should.have.key(
|
||||||
|
"Message"
|
||||||
|
).being.equal("newString")
|
||||||
|
updated_rule_description["Rule"]["Actions"][0]["BounceAction"].should.have.key(
|
||||||
|
"Sender"
|
||||||
|
).being.equal("newString")
|
||||||
|
|
||||||
|
with pytest.raises(ParamValidationError) as error:
|
||||||
|
conn.update_receipt_rule(
|
||||||
|
RuleSetName=rule_set_name,
|
||||||
|
Rule={
|
||||||
|
"Name": rule_name,
|
||||||
|
"Enabled": False,
|
||||||
|
"TlsPolicy": "Optional",
|
||||||
|
"Recipients": ["test@email.com", "test2@email.com"],
|
||||||
|
"Actions": [
|
||||||
|
{
|
||||||
|
"S3Action": {
|
||||||
|
"TopicArn": "newString",
|
||||||
|
"ObjectKeyPrefix": "updatedTestObjectKeyPrefix",
|
||||||
|
"KmsKeyArn": "newString",
|
||||||
|
},
|
||||||
|
"BounceAction": {
|
||||||
|
"TopicArn": "newString",
|
||||||
|
"StatusCode": "newString",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"ScanEnabled": False,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
assert (str(error.value)).should.contain(
|
||||||
|
'Parameter validation failed:\nMissing required parameter in Rule.Actions[0].S3Action: "BucketName"\nMissing required parameter in Rule.Actions[0].BounceAction: "SmtpReplyCode"\nMissing required parameter in Rule.Actions[0].BounceAction: "Message"\nMissing required parameter in Rule.Actions[0].BounceAction: "Sender"'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@mock_ses
|
@mock_ses
|
||||||
def test_create_ses_template():
|
def test_create_ses_template():
|
||||||
conn = boto3.client("ses", region_name="us-east-1")
|
conn = boto3.client("ses", region_name="us-east-1")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user