starting to fill in pending rackspace files tests

This commit is contained in:
Wesley Beary 2009-11-05 00:02:26 -08:00
parent 9ecb6f8a86
commit 9eaf469e99
7 changed files with 31 additions and 15 deletions

View File

@ -59,9 +59,10 @@ module Fog
},
:host => @cdn_host,
:method => params[:method],
:path => "#{@cdn_path}/#{params[:path]}"
:path => "#{@cdn_path}/#{params[:path]}",
:query => params[:query]
})
unless response.status == 204
unless response.body.empty?
response.body = JSON.parse(response.body)
end
response
@ -76,9 +77,10 @@ module Fog
},
:host => @storage_host,
:method => params[:method],
:path => "#{@storage_path}/#{params[:path]}"
:path => "#{@storage_path}/#{params[:path]}",
:query => params[:query]
})
unless response.status == 204
unless response.body.empty?
response.body = JSON.parse(response.body)
end
response

View File

@ -20,7 +20,7 @@ unless Fog.mocking?
# * 'name'<~String>: - Name of container
def get_containers(options = {})
options = { 'format' => 'json' }.merge!(options)
query = []
query = ''
for key, value in options
query << "#{key}=#{CGI.escape(value)}&"
end
@ -31,9 +31,6 @@ unless Fog.mocking?
:path => '',
:query => query
)
if response.status == 204
response.body = []
end
response
end

View File

@ -11,7 +11,7 @@ unless Fog.mocking?
#
def put_container(name)
response = storage_request(
:expects => 201,
:expects => [201, 202],
:method => 'PUT',
:path => CGI.escape(name)
)

View File

@ -3,9 +3,12 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.delete_container' do
describe 'success' do
before(:each) do
files.put_container('container_name')
end
it "should return proper attributes" do
pending
p files.delete_container(container_name)
files.delete_container('container_name')
end
end

View File

@ -5,7 +5,7 @@ describe 'Rackspace::Files.get_container' do
it "should return proper attributes" do
pending
p files.get_container(container_name)
files.get_container(container_name)
end
end

View File

@ -3,8 +3,19 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.get_containers' do
describe 'success' do
before(:each) do
files.put_container('container_name')
end
after(:each) do
files.delete_container('container_name')
end
it "should return proper attributes" do
p files.get_containers
actual = files.get_containers.body
actual.first['bytes'].should be_an(Integer)
actual.first['count'].should be_an(Integer)
actual.first['name'].should be_a(String)
end
end

View File

@ -3,9 +3,12 @@ require File.dirname(__FILE__) + '/../../../spec_helper'
describe 'Rackspace::Files.put_container' do
describe 'success' do
after(:each) do
files.delete_container('container_name')
end
it "should return proper attributes" do
pending
p files.put_container(container_name)
files.put_container('container_name')
end
end