mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
mocking delete_db_instance
This commit is contained in:
parent
735f8ec66c
commit
077ddc41ed
2 changed files with 21 additions and 13 deletions
|
@ -30,8 +30,24 @@ module Fog
|
||||||
|
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def delete_db_snapshot(identifier, snapshot_identifier, skip_snapshot = false)
|
def delete_db_instance(identifier, snapshot_identifier, skip_snapshot = false)
|
||||||
Fog::Mock.not_implemented
|
response = Excon::Response.new
|
||||||
|
|
||||||
|
unless skip_snapshot
|
||||||
|
# I don't know how to mock snapshot_identifier
|
||||||
|
Fog::Logger.warning("snapshot_identifier is not mocked [light_black](#{caller.first})[/]")
|
||||||
|
end
|
||||||
|
|
||||||
|
if server_set = self.data[:servers].delete(identifier)
|
||||||
|
response.status = 200
|
||||||
|
response.body = {
|
||||||
|
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
||||||
|
"DeleteDBInstanceResult" => { "DBInstance" => server_set }
|
||||||
|
}
|
||||||
|
response
|
||||||
|
else
|
||||||
|
raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,21 +35,13 @@ module Fog
|
||||||
def describe_db_instances(identifier=nil, opts={})
|
def describe_db_instances(identifier=nil, opts={})
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if identifier
|
if identifier
|
||||||
if self.data[:servers].has_key?(identifier)
|
if server_set = self.data[:servers][identifier]
|
||||||
servers_set = self.data[:servers][identifier]
|
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
response.body = {
|
||||||
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
||||||
"DescribeDBInstancesResult" => { "DBInstances" => [servers_set] }
|
"DescribeDBInstancesResult" => { "DBInstances" => [server_set] }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
response.status = 404
|
|
||||||
response.body = {
|
|
||||||
"ResponseMetadata"=>{ "RequestId"=> Fog::AWS::Mock.request_id },
|
|
||||||
"DescribeDBInstancesResult" => { "DBInstances" => 'DBInstanceNotFound' }
|
|
||||||
}
|
|
||||||
raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
|
raise Fog::AWS::RDS::NotFound.new("DBInstance #{identifier} not found")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue