2009-08-17 15:55:30 -07:00
|
|
|
require File.dirname(__FILE__) + '/../../../spec_helper'
|
2009-05-18 23:06:49 -07:00
|
|
|
|
|
|
|
describe 'SimpleDB.batch_put_attributes' do
|
2009-08-19 20:32:57 -07:00
|
|
|
describe 'success' do
|
2009-05-18 23:06:49 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
before(:all) do
|
|
|
|
@domain_name = "fog_domain_#{Time.now.to_i}"
|
|
|
|
sdb.create_domain(@domain_name)
|
|
|
|
end
|
2009-05-18 23:06:49 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
after(:all) do
|
|
|
|
sdb.delete_domain(@domain_name)
|
|
|
|
end
|
2009-05-18 23:06:49 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
it 'should return proper attributes' do
|
|
|
|
actual = sdb.batch_put_attributes(@domain_name, { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
|
|
|
actual.body['RequestId'].should be_a(String)
|
|
|
|
actual.body['BoxUsage'].should be_a(Float)
|
|
|
|
end
|
2009-05-18 23:06:49 -07:00
|
|
|
|
2009-08-19 20:32:57 -07:00
|
|
|
end
|
2009-09-07 21:25:50 -07:00
|
|
|
describe 'failure' do
|
|
|
|
|
|
|
|
it 'should raise a BadRequest error if the domain does not exist' do
|
|
|
|
lambda {
|
|
|
|
sdb.batch_put_attributes('notadomain', { 'a' => { 'b' => 'c' }, 'x' => { 'y' => 'z' } })
|
2009-10-31 12:26:49 -07:00
|
|
|
}.should raise_error(Excon::Errors::BadRequest)
|
2009-09-07 21:25:50 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2009-05-18 23:06:49 -07:00
|
|
|
end
|