Merge pull request #1750 from dm1try/cloudstack_add_list_os_types_and_list_disk_offerings_mocks

[cloudstack] Add list os types and list disk offerings mocks
This commit is contained in:
Wesley Beary 2013-04-11 07:52:37 -07:00
commit 359a1f4bb0
5 changed files with 60 additions and 7 deletions

View File

@ -422,7 +422,43 @@ module Fog
:jobs => {},
:volumes => {},
:security_groups => {},
:snapshots => {}
:snapshots => {},
:disk_offerings => {
"cc4de87d-672d-4353-abb5-6a8a4c0abf59" => {
"id" => "cc4de87d-672d-4353-abb5-6a8a4c0abf59",
"domainid" => domain_id,
"domain" => domain_name,
"name" => "Small Disk",
"displaytext" => "Small Disk [16GB Disk]",
"disksize" => 16,
"created" => "2013-02-21T03:12:520300",
"iscustomized" => false,
"storagetype" => "shared"
},
"d5deeb0c-de03-4ebf-820a-dc74221bcaeb" => {
"id" => "d5deeb0c-de03-4ebf-820a-dc74221bcaeb",
"domainid" => domain_id,
"domain" => domain_name,
"name" => "Medium Disk",
"displaytext" => "Medium Disk [32GB Disk]",
"disksize" => 32,
"created" => "2013-02-21T03:12:520300",
"iscustomized" => false,
"storagetype" => "shared"
}
},
:os_types => {
"51ef854d-279e-4e68-9059-74980fd7b29b" => {
"id" => "51ef854d-279e-4e68-9059-74980fd7b29b",
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
"description" => "Asianux 3(32-bit)"
},
"daf124c8-95d8-4756-8e1c-1871b073babb" => {
"id" => "daf124c8-95d8-4756-8e1c-1871b073babb",
"oscategoryid" => "56f67279-e082-45c3-a01c-d290d6cd4ce2",
"description" => "Asianux 3(64-bit)"
}
}
}
end
end

View File

@ -15,6 +15,15 @@ module Fog
end
end
class Mock
# TODO: add id, name filters and paging params
def list_disk_offerings(options={})
disk_offerings = self.data[:disk_offerings]
{ "listdiskofferingsresponse" => { "count"=> disk_offerings.count, "diskoffering"=> disk_offerings.values } }
end
end
end
end
end

View File

@ -15,6 +15,15 @@ module Fog
end
end
class Mock
# TODO: add id, category_id filters and paging params
def list_os_types(options={})
os_types = self.data[:os_types]
{ "listostypesresponse" => { "count"=> os_types.count, "ostype"=> os_types.values } }
end
end
end
end
end

View File

@ -4,14 +4,15 @@ Shindo.tests('Fog::Compute[:cloudstack] | disk offering requests', ['cloudstack'
'listdiskofferingsresponse' => {
'count' => Integer,
'diskoffering' => [
'id' => Integer,
'id' => String,
'created' => String,
'disksize' => Integer,
'displaytext' => String,
'domain' => Fog::Nullable::String,
'domainid' => Fog::Nullable::Integer,
'domainid' => Fog::Nullable::String,
'iscustomized' => Fog::Boolean,
'name' => String,
'storagetype' => String,
'tags' => Fog::Nullable::String
]
}
@ -20,7 +21,6 @@ Shindo.tests('Fog::Compute[:cloudstack] | disk offering requests', ['cloudstack'
tests('success') do
tests('#list_disk_offerings').formats(@disk_offerings_format) do
pending if Fog.mocking?
Fog::Compute[:cloudstack].list_disk_offerings
end

View File

@ -4,9 +4,9 @@ Shindo.tests('Fog::Compute[:cloudstack] | os type requests', ['cloudstack']) do
'listostypesresponse' => {
'count' => Integer,
'ostype' => [
'id' => Integer,
'id' => String,
'description' => String,
'oscategoryid' => Integer
'oscategoryid' => String
]
}
}
@ -24,7 +24,6 @@ Shindo.tests('Fog::Compute[:cloudstack] | os type requests', ['cloudstack']) do
tests('success') do
tests('#list_os_types').formats(@os_types_format) do
pending if Fog.mocking?
Fog::Compute[:cloudstack].list_os_types
end