2012-12-26 19:54:42 -05:00
|
|
|
Shindo.tests('Fog::Compute[:google] | firewall requests', ['google']) do
|
2012-10-22 20:15:33 -04:00
|
|
|
|
2012-12-26 19:54:42 -05:00
|
|
|
@google = Fog::Compute[:google]
|
2012-10-22 20:15:33 -04:00
|
|
|
|
|
|
|
@insert_firewall_format = {
|
|
|
|
'kind' => String,
|
|
|
|
'id' => String,
|
|
|
|
'selfLink' => String,
|
|
|
|
'name' => String,
|
|
|
|
'targetLink' => String,
|
|
|
|
'status' => String,
|
|
|
|
'user' => String,
|
|
|
|
'progress' => Integer,
|
|
|
|
'insertTime' => String,
|
|
|
|
'startTime' => String,
|
|
|
|
'operationType' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
@get_firewall_format = {
|
|
|
|
'kind' => String,
|
|
|
|
'id' => String,
|
|
|
|
'selfLink' => String,
|
|
|
|
'creationTimestamp' => String,
|
|
|
|
'name' => String,
|
|
|
|
'network' => String,
|
|
|
|
'sourceRanges' => [],
|
|
|
|
'allowed' => []
|
|
|
|
}
|
|
|
|
|
|
|
|
@delete_firewall_format = {
|
|
|
|
'kind' => String,
|
|
|
|
'id' => String,
|
|
|
|
'selfLink' => String,
|
|
|
|
'name' => String,
|
|
|
|
'targetLink' => String,
|
|
|
|
'status' => String,
|
|
|
|
'user' => String,
|
|
|
|
'progress' => Integer,
|
|
|
|
'targetId' => String,
|
|
|
|
'insertTime' => String,
|
|
|
|
'startTime' => String,
|
|
|
|
'operationType' => String
|
|
|
|
}
|
|
|
|
|
|
|
|
@list_firewalls_format = {
|
|
|
|
'kind' => String,
|
|
|
|
'id' => String,
|
|
|
|
'selfLink' => String,
|
|
|
|
'items' => []
|
|
|
|
}
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
|
|
|
firewall_name = 'new-firewall-test'
|
|
|
|
source_range = [ '10.0.0.0/8' ]
|
|
|
|
allowed = [{
|
|
|
|
"IPProtocol" => "tcp",
|
|
|
|
"ports" => [ "1-65535" ]
|
|
|
|
}, {
|
|
|
|
"IPProtocol" => "udp",
|
|
|
|
"ports" => [ "1-65535" ]
|
|
|
|
}, {
|
|
|
|
"IPProtocol" => "icmp"
|
|
|
|
}]
|
|
|
|
|
|
|
|
tests("#insert_firewall").formats(@insert_firewall_format) do
|
2012-12-04 15:02:51 -05:00
|
|
|
@google.insert_firewall(firewall_name, source_range, allowed).body
|
2012-10-22 20:15:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#get_firewall").formats(@get_firewall_format) do
|
2012-12-04 15:02:51 -05:00
|
|
|
@google.get_firewall(firewall_name).body
|
2012-10-22 20:15:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#list_firewalls").formats(@list_firewalls_format) do
|
2012-12-04 15:02:51 -05:00
|
|
|
@google.list_firewalls.body
|
2012-10-22 20:15:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests("#delete_firewall").formats(@delete_firewall_format) do
|
2012-12-04 15:02:51 -05:00
|
|
|
@google.delete_firewall(firewall_name).body
|
2012-10-22 20:15:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|