Minor RDS Clean up (#3682)
* Fix `DBInstanceNotFound` error message Changed from `Database` to `DBInstance`, which is actually what comes back from AWS. * Remove duplicate test The removed test actually fails if run in isolation because `rds2` is not a valid boto3 client service. The reason this test never caused CI to fail is because it is redefined later in the test suite, effectively making it dead code that will never run. Duplicate test has been removed and the remaining test has been improved with more explicit asserts.
This commit is contained in:
parent
676d61bf5b
commit
ae2865d559
@ -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),
|
||||
)
|
||||
|
||||
|
||||
|
@ -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."
|
||||
)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user