mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add Mock for get_runtime_info_section_type
This commit is contained in:
parent
5c6df7ea5f
commit
6d0acb00a2
3 changed files with 36 additions and 15 deletions
|
@ -20,6 +20,38 @@ module Fog
|
|||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def get_runtime_info_section_type(id)
|
||||
|
||||
type = 'application/vnd.vmware.vcloud.virtualHardwareSection+xml'
|
||||
|
||||
unless vm = data[:vms][id]
|
||||
raise Fog::Compute::VcloudDirector::Forbidden.new(
|
||||
'This operation is denied.'
|
||||
)
|
||||
end
|
||||
|
||||
Excon::Response.new(
|
||||
:status => 200,
|
||||
:headers => {'Content-Type' => "#{type};version=#{api_version}"},
|
||||
:body => get_vm_runtime_info_section_body(id, vm)
|
||||
)
|
||||
end
|
||||
|
||||
def get_vm_runtime_info_section_body(id, vm)
|
||||
{
|
||||
:xmlns_ns12 => "http://www.vmware.com/vcloud/v1.5",
|
||||
:ns12_href => make_href("vApp/#{id}/runtimeInfoSection"),
|
||||
:ns12_type => "application/vnd.vmware.vcloud.virtualHardwareSection+xml",
|
||||
:"ovf:Info" => "Specifies Runtime info",
|
||||
:VMWareTools => {
|
||||
:version => "9282",
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -144,19 +144,6 @@ module Fog
|
|||
}
|
||||
end
|
||||
|
||||
|
||||
def get_vm_runtime_info_section_body(id, vm)
|
||||
{
|
||||
:xmlns_ns12 => "http://www.vmware.com/vcloud/v1.5",
|
||||
:ns12_href => make_href("vApp/#{id}/runtimeInfoSection"),
|
||||
:ns12_type => "application/vnd.vmware.vcloud.virtualHardwareSection+xml",
|
||||
:"ovf:Info" => "Specifies Runtime info",
|
||||
:VMWareTools => {
|
||||
:version => "9282",
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def get_vm_virtual_hardware_section_body(id, vm)
|
||||
|
||||
{:xmlns_ns12=>"http://www.vmware.com/vcloud/v1.5",
|
||||
|
|
|
@ -69,9 +69,11 @@ Shindo.tests('Compute::VcloudDirector | vm requests', ['vclouddirector']) do
|
|||
@service.get_product_sections_vapp(vm_id).body.class
|
||||
end
|
||||
|
||||
tests("#get_vapp(#{vm_id}).body[:RuntimeInfoSection]").data_matches_schema(VcloudDirector::Compute::Schema::RUNTIME_INFO_SECTION_TYPE) do
|
||||
@service.get_vapp(vm_id).body[:RuntimeInfoSection]
|
||||
end
|
||||
|
||||
tests("#get_runtime_info_section_type(#{vm_id})").data_matches_schema(VcloudDirector::Compute::Schema::RUNTIME_INFO_SECTION_TYPE) do
|
||||
pending if Fog.mocking?
|
||||
pending # fails if WMware Tools not installed
|
||||
@service.get_runtime_info_section_type(vm_id).body
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue