1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/tests/requests/redshift/cluster_security_group_tests.rb
Josh Lane d48d376e9c initial import
* take the liberty of correcting Aws naming
2014-12-31 09:17:51 -08:00

42 lines
1.6 KiB
Ruby

Shindo.tests('Fog::Redshift[:aws] | cluster security group requests', ['aws']) do
pending if Fog.mocking?
suffix = rand(65536).to_s(16)
identifier = "test-cluster-security-group-#{suffix}"
@cluster_security_group_format = {
"ClusterSecurityGroup" => {
"EC2SecurityGroups" => Fog::Nullable::Array,
"IPRanges" => Fog::Nullable::Array,
"Description" => String,
"ClusterSecurityGroupName" => String
}
}
@describe_cluster_security_groups_format = {
"ClusterSecurityGroups" => [@cluster_security_group_format]
}
tests('success') do
tests("create_cluster_security_group").formats(@cluster_security_group_format) do
body = Fog::AWS[:redshift].create_cluster_security_group(:cluster_security_group_name => identifier, :description => 'testing').body
body
end
tests("describe_cluster_security_groups").formats(@describe_cluster_security_groups_format) do
body = Fog::AWS[:redshift].describe_cluster_security_groups.body
body
end
tests("delete_cluster_security_group") do
present = !Fog::AWS[:redshift].describe_cluster_security_groups(:cluster_security_group_name => identifier).body['ClusterSecurityGroups'].empty?
tests("verify presence before deletion").returns(true) { present }
Fog::AWS[:redshift].delete_cluster_security_group(:cluster_security_group_name => identifier)
not_present = Fog::AWS[:redshift].describe_cluster_security_groups(:cluster_security_group_name => identifier).body['ClusterSecurityGroups'].empty?
tests("verify deletion").returns(true) { not_present }
end
end
end