mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
delete_load_balancer_listeners and delete_load_balancer (with two more tests).
This commit is contained in:
parent
afdb06c893
commit
3a1287def0
3 changed files with 46 additions and 4 deletions
|
@ -28,6 +28,24 @@ module Fog
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
def delete_load_balancer(lb_name)
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
self.data[:load_balancers].delete(lb_name)
|
||||
|
||||
response.body = {
|
||||
'ResponseMetadata' => {
|
||||
'RequestId' => Fog::AWS::Mock.request_id
|
||||
},
|
||||
'DeleteLoadBalancerResult' => nil
|
||||
}
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,6 +26,25 @@ module Fog
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
class Mock
|
||||
def delete_load_balancer_listeners(lb_name, load_balancer_ports)
|
||||
raise Fog::AWS::ELB::NotFound unless load_balancer = self.data[:load_balancers][lb_name]
|
||||
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
load_balancer['ListenerDescriptions'].delete_if { |listener| load_balancer_ports.include? listener['Listener']['LoadBalancerPort'] }
|
||||
|
||||
response.body = {
|
||||
'ResponseMetadata' => {
|
||||
'RequestId' => Fog::AWS::Mock.request_id
|
||||
}
|
||||
}
|
||||
|
||||
response
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,14 +62,11 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, policies).body
|
||||
end
|
||||
|
||||
pending if Fog.mocking?
|
||||
|
||||
tests("#set_load_balancer_policies_of_listener removes policy").formats(AWS::ELB::Formats::BASIC) do
|
||||
port = 80
|
||||
body = AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
|
||||
AWS[:elb].set_load_balancer_policies_of_listener(@load_balancer_id, port, []).body
|
||||
end
|
||||
|
||||
|
||||
tests("#delete_load_balancer_listeners").formats(AWS::ELB::Formats::BASIC) do
|
||||
ports = [80, 443]
|
||||
AWS[:elb].delete_load_balancer_listeners(@load_balancer_id, ports).body
|
||||
|
@ -78,5 +75,13 @@ Shindo.tests('AWS::ELB | load_balancer_tests', ['aws', 'elb']) do
|
|||
tests("#delete_load_balancer").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer when non existant").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer('non-existant').body
|
||||
end
|
||||
|
||||
tests("#delete_load_balancer when already deleted").formats(AWS::ELB::Formats::DELETE_LOAD_BALANCER) do
|
||||
AWS[:elb].delete_load_balancer(@load_balancer_id).body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue