diff --git a/moto/rds2/exceptions.py b/moto/rds2/exceptions.py index 0232f11c7..8866b9bfd 100644 --- a/moto/rds2/exceptions.py +++ b/moto/rds2/exceptions.py @@ -24,7 +24,8 @@ class RDSClientError(BadRequest): class DBInstanceNotFoundError(RDSClientError): def __init__(self, database_identifier): super(DBInstanceNotFoundError, self).__init__( - "DBInstanceNotFound", "Database {0} not found.".format(database_identifier) + "DBInstanceNotFound", + "DBInstance {0} not found.".format(database_identifier), ) diff --git a/tests/test_rds2/test_filters.py b/tests/test_rds2/test_filters.py index a59867d24..5f6668219 100644 --- a/tests/test_rds2/test_filters.py +++ b/tests/test_rds2/test_filters.py @@ -127,7 +127,7 @@ class TestDBInstanceFilters(object): ) ex.value.response["Error"]["Code"].should.equal("DBInstanceNotFound") ex.value.response["Error"]["Message"].should.equal( - "Database non-existent not found." + "DBInstance non-existent not found." ) def test_valid_db_instance_identifier_with_exclusive_filter(self): @@ -172,7 +172,7 @@ class TestDBInstanceFilters(object): ) ex.value.response["Error"]["Code"].should.equal("DBInstanceNotFound") ex.value.response["Error"]["Message"].should.equal( - "Database db-instance-0 not found." + "DBInstance db-instance-0 not found." ) diff --git a/tests/test_rds2/test_rds2.py b/tests/test_rds2/test_rds2.py index 524589c80..393a46163 100644 --- a/tests/test_rds2/test_rds2.py +++ b/tests/test_rds2/test_rds2.py @@ -2,6 +2,7 @@ from __future__ import unicode_literals from botocore.exceptions import ClientError import boto3 +import pytest import sure # noqa from moto import mock_ec2, mock_kms, mock_rds2 from moto.core import ACCOUNT_ID @@ -471,14 +472,6 @@ def test_delete_database(): snapshots[0].get("Engine").should.equal("postgres") -@mock_rds2 -def test_delete_non_existent_database(): - conn = boto3.client("rds2", region_name="us-west-2") - conn.delete_db_instance.when.called_with( - DBInstanceIdentifier="not-a-db" - ).should.throw(ClientError) - - @mock_rds2 def test_create_db_snapshots(): conn = boto3.client("rds", region_name="us-west-2") @@ -793,9 +786,12 @@ def test_modify_non_existent_option_group(): @mock_rds2 def test_delete_non_existent_database(): conn = boto3.client("rds", region_name="us-west-2") - conn.delete_db_instance.when.called_with( - DBInstanceIdentifier="not-a-db" - ).should.throw(ClientError) + with pytest.raises(ClientError) as ex: + conn.delete_db_instance(DBInstanceIdentifier="non-existent") + ex.value.response["Error"]["Code"].should.equal("DBInstanceNotFound") + ex.value.response["Error"]["Message"].should.equal( + "DBInstance non-existent not found." + ) @mock_rds2