mirror of
https://github.com/fog/fog-aws.git
synced 2022-11-09 13:50:52 -05:00
d48d376e9c
* take the liberty of correcting Aws naming
55 lines
2.3 KiB
Ruby
55 lines
2.3 KiB
Ruby
Shindo.tests('Fog::Compute[:aws] | internet_gateway requests', ['aws']) do
|
|
|
|
tests('success') do
|
|
Fog::Compute::AWS::Mock.reset if Fog.mocking?
|
|
|
|
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
|
|
@vpc_id = @vpc.id
|
|
|
|
@subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24')
|
|
@subnet_id = @subnet.subnet_id
|
|
|
|
@network_interface = Fog::Compute[:aws].network_interfaces.new(:subnet_id => @subnet_id)
|
|
@network_interface.save
|
|
@network_interface_id = @network_interface.network_interface_id
|
|
|
|
@ip_address = Fog::AWS::Mock.ip_address
|
|
@second_ip_address = Fog::AWS::Mock.ip_address
|
|
|
|
tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}']})").formats(Aws::Compute::Formats::BASIC) do
|
|
Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address]}).body
|
|
end
|
|
|
|
tests("#assign_private_ip_addresses('#{@network_interface_id}', {'SecondaryPrivateIpAddressCount'=>4})").formats(Aws::Compute::Formats::BASIC) do
|
|
Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, {'SecondaryPrivateIpAddressCount'=>4}).body
|
|
end
|
|
|
|
@network_interface.destroy
|
|
@subnet.destroy
|
|
@vpc.destroy
|
|
end
|
|
|
|
tests('failure') do
|
|
Fog::Compute::AWS::Mock.reset if Fog.mocking?
|
|
|
|
@vpc=Fog::Compute[:aws].vpcs.create('cidr_block' => '10.0.10.0/24')
|
|
@vpc_id = @vpc.id
|
|
|
|
@subnet=Fog::Compute[:aws].subnets.create('vpc_id' => @vpc_id, 'cidr_block' => '10.0.10.0/24')
|
|
@subnet_id = @subnet.subnet_id
|
|
|
|
@network_interface = Fog::Compute[:aws].network_interfaces.new(:subnet_id => @subnet_id)
|
|
@network_interface.save
|
|
@network_interface_id = @network_interface.network_interface_id
|
|
|
|
@ip_address = Fog::AWS::Mock.ip_address
|
|
|
|
tests("#assign_private_ip_addresses('#{@network_interface_id}', {'PrivateIpAddresses'=>['#{@ip_address}','#{@second_ip_address}'], 'SecondaryPrivateIpAddressCount'=>4 })").raises(Fog::Compute::AWS::Error) do
|
|
Fog::Compute[:aws].assign_private_ip_addresses(@network_interface_id, { 'PrivateIpAddresses' =>[@ip_address, @second_ip_address], 'SecondaryPrivateIpAddressCount'=>4 }).body
|
|
end
|
|
|
|
@network_interface.destroy
|
|
@subnet.destroy
|
|
@vpc.destroy
|
|
end
|
|
end
|