2012-04-06 17:45:11 -04:00
|
|
|
Shindo.tests("Fog::Compute[:hp] | security_group", ['hp']) do
|
2013-02-05 06:19:02 -05:00
|
|
|
# Disabled due to https://github.com/fog/fog/1546
|
|
|
|
pending
|
2012-04-06 17:45:11 -04:00
|
|
|
|
|
|
|
model_tests(Fog::Compute[:hp].security_groups, {:name => 'foggroupname', :description => 'foggroupdescription'}, true)
|
|
|
|
|
|
|
|
tests("a group with trailing whitespace") do
|
2012-04-10 14:57:11 -04:00
|
|
|
@group = Fog::Compute[:hp].security_groups.create(:name => " foggroup with spaces ", :description => " fog group desc ")
|
2012-04-06 17:45:11 -04:00
|
|
|
|
2012-04-10 14:57:11 -04:00
|
|
|
test("all spaces are removed from name") do
|
|
|
|
@group.name == " foggroup with spaces ".strip!
|
2012-04-06 17:45:11 -04:00
|
|
|
end
|
|
|
|
|
2012-04-10 14:57:11 -04:00
|
|
|
test("all spaces are removed from description") do
|
|
|
|
@group.description == " fog group desc ".strip!
|
2012-04-06 17:45:11 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
@other_group = Fog::Compute[:hp].security_groups.create(:name => 'other group', :description => 'another group')
|
|
|
|
|
|
|
|
test("authorize access by another security group") do
|
|
|
|
sgrule = @group.create_rule(80..80, "tcp", nil, @other_group.id)
|
|
|
|
@sg_rule_id = sgrule.body['security_group_rule']['id']
|
|
|
|
@group.reload
|
|
|
|
s = @group.rules.select {|r| r['id'] == @sg_rule_id unless r.nil?}
|
|
|
|
s[0]['id'] == @sg_rule_id
|
|
|
|
end
|
|
|
|
|
|
|
|
test("revoke access from another security group") do
|
|
|
|
@group.delete_rule(@sg_rule_id)
|
|
|
|
@group.reload
|
|
|
|
s = @group.rules.select {|r| r['id'] == @sg_rule_id unless r.nil?}
|
|
|
|
s.empty?
|
|
|
|
end
|
|
|
|
|
|
|
|
@other_group.destroy
|
|
|
|
@group.destroy
|
|
|
|
end
|
|
|
|
end
|