mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
spec and related fixes
This commit is contained in:
parent
d6e857e52d
commit
9ecb6f8a86
13 changed files with 13 additions and 25 deletions
|
@ -11,7 +11,7 @@ module Fog
|
|||
model Fog::Rackspace::Servers::Server
|
||||
|
||||
def all
|
||||
data = connection.list_servers_details.body
|
||||
data = connection.list_servers_detail.body
|
||||
servers = Fog::Rackspace::Servers::Servers.new({
|
||||
:connection => connection
|
||||
})
|
||||
|
|
|
@ -14,7 +14,7 @@ unless Fog.mocking?
|
|||
response = storage_request(
|
||||
:body => data[:body],
|
||||
:expects => 201,
|
||||
:headers => data[:headers,]
|
||||
:headers => data[:headers],
|
||||
:method => 'PUT',
|
||||
:path => "#{CGI.escape(container)}/#{CGI.escape(object)}"
|
||||
)
|
||||
|
|
|
@ -13,12 +13,9 @@ unless Fog.mocking?
|
|||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * 'image'<~Hash>:
|
||||
# * 'created'<~Time> - Creation time
|
||||
# * 'id'<~Integer> - Id of image
|
||||
# * 'name'<~String> - Name of image
|
||||
# * 'progress'<~String> - Percentage of completion
|
||||
# * 'serverId'<~Integer> - Id of server
|
||||
# * 'status'<~String> - Current status
|
||||
def create_image(server_id, options = {})
|
||||
data = {
|
||||
'image' => {
|
||||
|
|
|
@ -15,7 +15,7 @@ unless Fog.mocking?
|
|||
# * 'addresses'<~Array>:
|
||||
# * 'public'<~Array> - Public ip addresses
|
||||
# * 'private'<~Array> - Private ip addresses
|
||||
def list_addresses
|
||||
def list_addresses(server_id)
|
||||
request(
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
|
@ -33,7 +33,7 @@ else
|
|||
module Rackspace
|
||||
class Servers
|
||||
|
||||
def list_addresses
|
||||
def list_addresses(server_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ unless Fog.mocking?
|
|||
# * 'name'<~String> - Name of the flavor
|
||||
def list_flavors
|
||||
request(
|
||||
:expects => 200,
|
||||
:expects => [200, 203],
|
||||
:method => 'GET',
|
||||
:path => 'flavors.json'
|
||||
)
|
||||
|
|
|
@ -48,12 +48,6 @@ module Fog
|
|||
})
|
||||
unless response.body.empty?
|
||||
response.body = JSON.parse(response.body)
|
||||
if response.body['created']
|
||||
response.body['created'] = Time.parse(response.body['created'])
|
||||
end
|
||||
if response.body['updated']
|
||||
response.body['updated'] = Time.parse(response.body['updated'])
|
||||
end
|
||||
end
|
||||
response
|
||||
end
|
||||
|
|
|
@ -16,13 +16,10 @@ describe 'Rackspace::Servers.create_image' do
|
|||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.create_image(@server_id)['image']
|
||||
actual['created'].should be_a(Time)
|
||||
actual = servers.create_image(@server_id).body['image']
|
||||
@image_id = actual['id']
|
||||
actual['id'].should be_an(Integer)
|
||||
actual['name'].should be_a(String)
|
||||
actual['progress'].should be_an(Integer)
|
||||
actual['serverId'].should be_an(Integer)
|
||||
actual['status'].should be_a(String)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ describe 'Rackspace::Servers.delete_server' do
|
|||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
eventually(128) do
|
||||
eventually do
|
||||
servers.delete_server(@server_id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ describe 'Rackspace::Servers.list_addresses' do
|
|||
end
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_addresses(@server_id)
|
||||
actual = servers.list_addresses(@server_id).body
|
||||
actual['addresses'].should be_a(Hash)
|
||||
actual['addresses']['private'].should be_an(Array)
|
||||
actual['addresses']['public'].should be_an(Array)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_flavors_detail' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_flavors_detail
|
||||
actual = servers.list_flavors_detail.body
|
||||
actual['flavors'].should be_an(Array)
|
||||
flavor = actual['flavors'].first
|
||||
flavor['disk'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_flavors' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_flavors
|
||||
actual = servers.list_flavors.body
|
||||
actual['flavors'].should be_an(Array)
|
||||
flavor = actual['flavors'].first
|
||||
flavor['id'].should be_an(Integer)
|
||||
|
|
|
@ -4,7 +4,7 @@ describe 'Rackspace::Servers.list_images' do
|
|||
describe 'success' do
|
||||
|
||||
it "should return proper attributes" do
|
||||
actual = servers.list_images
|
||||
actual = servers.list_images.body
|
||||
actual['images'].should be_an(Array)
|
||||
image = actual['images'].first
|
||||
image['id'].should be_an(Integer)
|
||||
|
|
Loading…
Add table
Reference in a new issue