Merge pull request #1585 from bpandola/fix-1569
Fix rds.describe_db_snapshots bugs
This commit is contained in:
commit
23b51c39a1
@ -726,10 +726,11 @@ class RDS2Backend(BaseBackend):
|
|||||||
|
|
||||||
def describe_snapshots(self, db_instance_identifier, db_snapshot_identifier):
|
def describe_snapshots(self, db_instance_identifier, db_snapshot_identifier):
|
||||||
if db_instance_identifier:
|
if db_instance_identifier:
|
||||||
|
db_instance_snapshots = []
|
||||||
for snapshot in self.snapshots.values():
|
for snapshot in self.snapshots.values():
|
||||||
if snapshot.database.db_instance_identifier == db_instance_identifier:
|
if snapshot.database.db_instance_identifier == db_instance_identifier:
|
||||||
return [snapshot]
|
db_instance_snapshots.append(snapshot)
|
||||||
raise DBSnapshotNotFoundError()
|
return db_instance_snapshots
|
||||||
|
|
||||||
if db_snapshot_identifier:
|
if db_snapshot_identifier:
|
||||||
if db_snapshot_identifier in self.snapshots:
|
if db_snapshot_identifier in self.snapshots:
|
||||||
|
@ -353,8 +353,6 @@ def test_describe_db_snapshots():
|
|||||||
MasterUserPassword='hunter2',
|
MasterUserPassword='hunter2',
|
||||||
Port=1234,
|
Port=1234,
|
||||||
DBSecurityGroups=["my_sg"])
|
DBSecurityGroups=["my_sg"])
|
||||||
conn.describe_db_snapshots.when.called_with(
|
|
||||||
DBInstanceIdentifier="db-primary-1").should.throw(ClientError)
|
|
||||||
|
|
||||||
created = conn.create_db_snapshot(DBInstanceIdentifier='db-primary-1',
|
created = conn.create_db_snapshot(DBInstanceIdentifier='db-primary-1',
|
||||||
DBSnapshotIdentifier='snapshot-1').get('DBSnapshot')
|
DBSnapshotIdentifier='snapshot-1').get('DBSnapshot')
|
||||||
@ -369,6 +367,11 @@ def test_describe_db_snapshots():
|
|||||||
snapshot.should.equal(created)
|
snapshot.should.equal(created)
|
||||||
snapshot.get('Engine').should.equal('postgres')
|
snapshot.get('Engine').should.equal('postgres')
|
||||||
|
|
||||||
|
conn.create_db_snapshot(DBInstanceIdentifier='db-primary-1',
|
||||||
|
DBSnapshotIdentifier='snapshot-2')
|
||||||
|
snapshots = conn.describe_db_snapshots(DBInstanceIdentifier='db-primary-1').get('DBSnapshots')
|
||||||
|
snapshots.should.have.length_of(2)
|
||||||
|
|
||||||
|
|
||||||
@mock_rds2
|
@mock_rds2
|
||||||
def test_delete_db_snapshot():
|
def test_delete_db_snapshot():
|
||||||
|
Loading…
Reference in New Issue
Block a user