2009-06-25 00:32:27 -07:00
|
|
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
|
|
|
2009-07-22 19:28:53 -07:00
|
|
|
describe 'S3.get_bucket_location' do
|
2009-06-25 00:32:27 -07:00
|
|
|
|
|
|
|
before(:all) do
|
2009-08-11 21:40:59 -07:00
|
|
|
@s3 = Fog::AWS::S3.gen
|
|
|
|
@eu_s3 = Fog::AWS::S3.gen(:eu)
|
2009-08-08 22:40:42 -07:00
|
|
|
@s3.put_bucket('foggetlocation', 'LocationConstraint' => 'EU')
|
2009-06-25 00:32:27 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
after(:all) do
|
2009-08-08 22:40:42 -07:00
|
|
|
if Fog.mocking?
|
|
|
|
@eu_s3.data = @s3.data
|
|
|
|
end
|
|
|
|
@eu_s3.delete_bucket('foggetlocation')
|
2009-06-25 00:32:27 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should return proper attributes' do
|
2009-08-08 22:40:42 -07:00
|
|
|
actual = @s3.get_bucket_location('foggetlocation')
|
2009-06-25 00:32:27 -07:00
|
|
|
actual.status.should == 200
|
2009-07-29 19:50:51 -07:00
|
|
|
actual.body['LocationConstraint'].should == 'EU'
|
2009-06-25 00:32:27 -07:00
|
|
|
end
|
|
|
|
|
2009-08-16 13:31:36 -07:00
|
|
|
it 'should raise NotFound error if bucket does not exist' do
|
|
|
|
lambda {
|
|
|
|
@s3.get_bucket_location('fognotabucket')
|
|
|
|
}.should raise_error(Fog::Errors::NotFound)
|
|
|
|
end
|
|
|
|
|
2009-06-25 00:32:27 -07:00
|
|
|
end
|