mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Update tests and mocks based on real pro data.
This commit is contained in:
parent
664002a7dc
commit
36d4dcbefe
2 changed files with 26 additions and 11 deletions
|
@ -101,11 +101,16 @@ module Fog
|
|||
response = Excon::Response.new
|
||||
response.status = 202
|
||||
|
||||
if options['security_groups']
|
||||
sec_group_name = options['security_groups'][0]
|
||||
else
|
||||
sec_group_name = "default"
|
||||
end
|
||||
data = {
|
||||
'addresses' => { "private"=>[{"version"=>4, "addr"=>Fog::HP::Mock.ip_address}] },
|
||||
'flavor' => {"id"=>"1", "links"=>[{"href"=>"http://nova1:8774/admin/flavors/1", "rel"=>"bookmark"}]},
|
||||
'id' => Fog::Mock.random_numbers(6).to_s,
|
||||
'image' => {"id"=>"3", "links"=>[{"href"=>"http://nova1:8774/admin/images/3", "rel"=>"bookmark"}]},
|
||||
'addresses' => {},
|
||||
'flavor' => {"id"=>"#{flavor_id}", "links"=>[{"href"=>"http://nova1:8774/admin/flavors/#{flavor_id}", "rel"=>"bookmark"}]},
|
||||
'id' => Fog::Mock.random_numbers(6).to_i,
|
||||
'image' => {"id"=>"#{image_id}", "links"=>[{"href"=>"http://nova1:8774/admin/images/#{image_id}", "rel"=>"bookmark"}]},
|
||||
'links' => [{"href"=>"http://nova1:8774/v1.1/admin/servers/5", "rel"=>"self"}, {"href"=>"http://nova1:8774/admin/servers/5", "rel"=>"bookmark"}],
|
||||
'hostId' => "123456789ABCDEF01234567890ABCDEF",
|
||||
'metadata' => options['metadata'] || {},
|
||||
|
@ -114,9 +119,14 @@ module Fog
|
|||
'accessIPv6' => options['accessIPv6'] || "",
|
||||
'progress' => 0,
|
||||
'status' => 'BUILD',
|
||||
'created' => "2012-01-01T13:32:20Z",
|
||||
'updated' => "2012-01-01T13:32:20Z",
|
||||
'user_id' => Fog::HP::Mock.user_id.to_s,
|
||||
'tenant_id' => Fog::HP::Mock.user_id.to_s,
|
||||
'key_name' => options['key_name'] || "",
|
||||
'uuid' => "95253a45-9ead-43c6-90b3-65da2ef048b3",
|
||||
'config_drive' => "",
|
||||
#'security_groups' => [{"name"=>"#{sec_group_name}", "links"=>[{"href"=>"http://nova1:8774/v1.1/admin//os-security-groups/111", "rel"=>"bookmark"}], "id"=>111}],
|
||||
'key_name' => options['key_name'] || ""
|
||||
}
|
||||
self.data[:last_modified][:servers][data['id']] = Time.now
|
||||
self.data[:servers][data['id']] = data
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
Shindo.tests('Fog::Compute[:hp] | server requests', ['hp']) do
|
||||
|
||||
@server_format = {
|
||||
'addresses' => {
|
||||
'private' => [Hash]
|
||||
},
|
||||
'addresses' => Fog::Nullable::Hash,
|
||||
'flavor' => Hash,
|
||||
'id' => String,
|
||||
'id' => Integer,
|
||||
'image' => Hash,
|
||||
'links' => [Hash],
|
||||
'hostId' => String,
|
||||
|
@ -15,14 +13,21 @@ Shindo.tests('Fog::Compute[:hp] | server requests', ['hp']) do
|
|||
'accessIPv6' => Fog::Nullable::String,
|
||||
'progress' => Fog::Nullable::Integer,
|
||||
'status' => String,
|
||||
'created' => String,
|
||||
'updated' => String,
|
||||
'user_id' => String,
|
||||
'tenant_id' => String,
|
||||
'uuid' => String,
|
||||
'config_drive' => Fog::Nullable::String,
|
||||
#'security_groups' => [Hash],
|
||||
'key_name' => Fog::Nullable::String
|
||||
}
|
||||
|
||||
@list_servers_format = {
|
||||
'uuid' => Fog::Nullable::String,
|
||||
'links' => [Hash],
|
||||
'name' => String,
|
||||
'id' => String
|
||||
'id' => Integer
|
||||
}
|
||||
|
||||
@get_console_output_format = {
|
||||
|
@ -111,7 +116,7 @@ Shindo.tests('Fog::Compute[:hp] | server requests', ['hp']) do
|
|||
Fog::Compute[:hp].reboot_server(0)
|
||||
end
|
||||
|
||||
tests("#change_password_server(0}, 'new_password')").raises(Fog::Compute::HP::NotFound) do
|
||||
tests("#change_password_server(0}, 'new_password')").raises(Excon::Errors::InternalServerError) do
|
||||
Fog::Compute[:hp].change_password_server(0, 'new_password')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue