diff --git a/moto/redshift/models.py b/moto/redshift/models.py index 0bdb14edc..625796f8a 100644 --- a/moto/redshift/models.py +++ b/moto/redshift/models.py @@ -573,10 +573,8 @@ class RedshiftBackend(BaseBackend): cluster.encrypted == "true" and kwargs["snapshot_copy_grant_name"] is None ): - raise ClientError( - "InvalidParameterValue", - "SnapshotCopyGrantName is required for Snapshot Copy " - "on KMS encrypted clusters.", + raise InvalidParameterValueError( + "SnapshotCopyGrantName is required for Snapshot Copy on KMS encrypted clusters." ) status = { "DestinationRegion": kwargs["destination_region"], diff --git a/tests/test_redshift/test_redshift.py b/tests/test_redshift/test_redshift.py index cf96ee15f..8272cea82 100644 --- a/tests/test_redshift/test_redshift.py +++ b/tests/test_redshift/test_redshift.py @@ -12,6 +12,7 @@ from boto.redshift.exceptions import ( InvalidSubnet, ) from botocore.exceptions import ClientError +import pytest import sure # noqa from moto import mock_ec2 @@ -1260,6 +1261,14 @@ def test_enable_snapshot_copy(): MasterUserPassword="password", NodeType="ds2.xlarge", ) + with pytest.raises(ClientError) as ex: + client.enable_snapshot_copy( + ClusterIdentifier="test", DestinationRegion="us-west-2", RetentionPeriod=3, + ) + ex.value.response["Error"]["Code"].should.equal("InvalidParameterValue") + ex.value.response["Error"]["Message"].should.contain( + "SnapshotCopyGrantName is required for Snapshot Copy on KMS encrypted clusters." + ) client.enable_snapshot_copy( ClusterIdentifier="test", DestinationRegion="us-west-2",