mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[simpleDB] - not populating the :replace attributes with keys from :expect.
This commit is contained in:
parent
6ddf8e67a1
commit
53ce447574
2 changed files with 4 additions and 6 deletions
|
@ -16,7 +16,7 @@ module Fog
|
||||||
# and sequences not allowed in xml are not valid. Each name and value can
|
# and sequences not allowed in xml are not valid. Each name and value can
|
||||||
# be up to 1024 bytes long.
|
# be up to 1024 bytes long.
|
||||||
# * options<~Hash> - Accepts the following keys.
|
# * options<~Hash> - Accepts the following keys.
|
||||||
# :replace => [Array of keys to replace, will be combined with any keys from :expect]
|
# :replace => [Array of keys to replace]
|
||||||
# :expect => {name/value pairs for performing conditional put}
|
# :expect => {name/value pairs for performing conditional put}
|
||||||
#
|
#
|
||||||
# ==== Returns
|
# ==== Returns
|
||||||
|
@ -27,7 +27,6 @@ module Fog
|
||||||
def put_attributes(domain_name, item_name, attributes, options = {})
|
def put_attributes(domain_name, item_name, attributes, options = {})
|
||||||
options[:expect] = {} unless options[:expect]
|
options[:expect] = {} unless options[:expect]
|
||||||
options[:replace] = [] unless options[:replace]
|
options[:replace] = [] unless options[:replace]
|
||||||
options[:replace] += options[:expect].keys
|
|
||||||
request({
|
request({
|
||||||
'Action' => 'PutAttributes',
|
'Action' => 'PutAttributes',
|
||||||
'DomainName' => domain_name,
|
'DomainName' => domain_name,
|
||||||
|
@ -43,7 +42,6 @@ module Fog
|
||||||
def put_attributes(domain_name, item_name, attributes, options = {})
|
def put_attributes(domain_name, item_name, attributes, options = {})
|
||||||
options[:expect] = {} unless options[:expect]
|
options[:expect] = {} unless options[:expect]
|
||||||
options[:replace] = [] unless options[:replace]
|
options[:replace] = [] unless options[:replace]
|
||||||
options[:replace] += options[:expect].keys
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
if @data[:domains][domain_name]
|
if @data[:domains][domain_name]
|
||||||
options[:expect].each do |ck, cv|
|
options[:expect].each do |ck, cv|
|
||||||
|
|
|
@ -20,8 +20,8 @@ describe 'SimpleDB.put_attributes' do
|
||||||
|
|
||||||
it 'conditional put should succeed' do
|
it 'conditional put should succeed' do
|
||||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '1' })
|
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '1' })
|
||||||
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' })
|
AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||||
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '3' }, :expect => { 'version' => '2' })
|
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '3' }, :expect => { 'version' => '2' }, :replace => ['version'])
|
||||||
actual.body['RequestId'].should be_a(String)
|
actual.body['RequestId'].should be_a(String)
|
||||||
actual.body['BoxUsage'].should be_a(Float)
|
actual.body['BoxUsage'].should be_a(Float)
|
||||||
end
|
end
|
||||||
|
@ -32,7 +32,7 @@ describe 'SimpleDB.put_attributes' do
|
||||||
actual.body['BoxUsage'].should be_a(Float)
|
actual.body['BoxUsage'].should be_a(Float)
|
||||||
|
|
||||||
lambda {
|
lambda {
|
||||||
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' })
|
actual = AWS[:sdb].put_attributes(@domain_name, 'foo', { 'version' => '2' }, :expect => { 'version' => '1' }, :replace => ['version'])
|
||||||
}.should raise_error(Excon::Errors::Conflict)
|
}.should raise_error(Excon::Errors::Conflict)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue