1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[ec2] allow snapshots to have descriptions

This commit is contained in:
Andy Delcambre 2010-08-21 07:14:40 +08:00 committed by Wesley Beary
parent 619ae8d7d3
commit a043c6c647
2 changed files with 10 additions and 6 deletions

View file

@ -32,7 +32,7 @@ module Fog
def save
requires :volume_id
data = connection.create_snapshot(@volume_id).body
data = connection.create_snapshot(@volume_id, @description).body
new_attributes = data.reject {|key,value| key == 'requestId'}
merge_attributes(new_attributes)
true

View file

@ -24,11 +24,13 @@ describe 'Fog::AWS::EC2::Snapshot' do
snapshot = AWS[:ec2].snapshots.new(
'snapshotId' => 'snap-00000000',
'startTime' => 'now',
'volumeId' => 'vol-00000000'
'volumeId' => 'vol-00000000',
'description' => 'taken for safety'
)
snapshot.id.should == 'snap-00000000'
snapshot.created_at.should == 'now'
snapshot.volume_id.should == 'vol-00000000'
snapshot.description.should == 'taken for safety'
end
end
@ -60,16 +62,18 @@ describe 'Fog::AWS::EC2::Snapshot' do
describe "#save" do
before(:each) do
@snapshot = @volume.snapshots.new
end
it "should persist the snapshot" do
@snapshot = @volume.snapshots.new
AWS[:ec2].snapshots.get(@snapshot.id).should be_nil
@snapshot.save.should be_true
AWS[:ec2].snapshots.get(@snapshot.id).should_not be_nil
end
it "should allow a description" do
@snapshot = @volume.snapshots.create(:description => 'taken for safety')
AWS[:ec2].snapshots.get(@snapshot.id).description.should == 'taken for safety'
end
end
end