[ec2] update snapshot mocks to match recent parser updates

This commit is contained in:
geemus 2010-05-08 18:13:33 -07:00
parent 04ecade81b
commit 9d2cea276a
2 changed files with 9 additions and 3 deletions

View File

@ -30,17 +30,20 @@ module Fog
class Mock
def create_snapshot(volume_id)
def create_snapshot(volume_id, description = nil)
response = Excon::Response.new
if @data[:volumes][volume_id]
if volume = @data[:volumes][volume_id]
response.status = 200
snapshot_id = Fog::AWS::Mock.snapshot_id
data = {
'description' => description,
'ownerId' => @owner_id,
'progress' => nil,
'snapshotId' => snapshot_id,
'startTime' => Time.now,
'status' => 'pending',
'volumeId' => volume_id
'volumeId' => volume_id,
'volumeSize' => volume['size']
}
@data[:snapshots][snapshot_id] = data
response.body = {

View File

@ -53,6 +53,9 @@ module Fog
elsif Time.now - snapshot['startTime'] > Fog::Mock.delay
snapshot['progress'] = '50%'
snapshot['status'] = 'in progress'
else
snapshot['progress'] = '0%'
snapshot['status'] = 'in progress'
end
end
end