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

describe_snapshot fixes/specs

This commit is contained in:
Wesley Beary 2009-07-19 14:14:08 -07:00
parent 312386d57a
commit 5775b8b536
3 changed files with 42 additions and 9 deletions

View file

@ -8,7 +8,15 @@ module Fog
# * snapshot_id<~Array> - List of snapshots to describe, defaults to all # * snapshot_id<~Array> - List of snapshots to describe, defaults to all
# #
# ==== Returns # ==== Returns
# FIXME: docs # * response<~Fog::AWS::Response>:
# * body<~Hash>:
# * :request_id<~String> - Id of request
# * :snapshot_set<~Array>:
# * :progress<~String>: The percentage progress of the snapshot
# * :snapshot_id<~String>: Id of the snapshot
# * :start_time<~Time>: Timestamp of when snapshot was initiated
# * :status<~String>: Snapshot state, in ['pending', 'completed']
# * :volume_id<~String>: Id of volume that snapshot contains
def describe_snapshots(snapshot_id = []) def describe_snapshots(snapshot_id = [])
params = indexed_params('SnapshotId', snapshot_id) params = indexed_params('SnapshotId', snapshot_id)
request({ request({

View file

@ -14,18 +14,18 @@ describe 'EC2.describe_key_pairs' do
actual = ec2.describe_key_pairs actual = ec2.describe_key_pairs
actual.body[:key_set].should be_an(Array) actual.body[:key_set].should be_an(Array)
actual.body[:request_id].should be_a(String) actual.body[:request_id].should be_a(String)
key = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first key_pair = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first
key[:key_name].should == 'key_name' key_pair[:key_fingerprint].should be_a(String)
key[:key_fingerprint].should be_a(String) key_pair[:key_name].should be_a(String)
end end
it "should return proper attributes with params" do it "should return proper attributes with params" do
actual = ec2.describe_key_pairs(['key_name']) actual = ec2.describe_key_pairs(['key_name'])
actual.body[:key_set].should be_an(Array) actual.body[:key_set].should be_an(Array)
actual.body[:request_id].should be_a(String) actual.body[:request_id].should be_a(String)
key = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first key_pair = actual.body[:key_set].select {|key| key[:key_name] == 'key_name' }.first
key[:key_name].should == 'key_name' key_pair[:key_fingerprint].should be_a(String)
key[:key_fingerprint].should be_a(String) key_pair[:key_name].should be_a(String)
end end
end end

View file

@ -2,11 +2,36 @@ require File.dirname(__FILE__) + '/../../spec_helper'
describe 'EC2.describe_snapshots' do describe 'EC2.describe_snapshots' do
it "should return proper attributes with no params" do before(:all) do
actual = ec2.describe_snapshots @volume_id = ec2.create_volume('us-east-1a', 1).body[:volume_id]
p actual @snapshot_id = ec2.create_snapshot(@volume_id).body[:snapshot_id]
end end
it "should return proper attributes with params" after(:all) do
ec2.delete_volume(@volume_id)
eventually { ec2.delete_snapshot(@snapshot_id) }
end
it "should return proper attributes with no params" do
actual = ec2.describe_snapshots
actual.body[:snapshot_set].should be_an(Array)
snapshot = actual.body[:snapshot_set].select {|snapshot| snapshot[:snapshot_id] == @snapshot_id}.first
snapshot[:progress].should be_a(String)
snapshot[:snapshot_id].should be_a(String)
snapshot[:start_time].should be_a(Time)
snapshot[:status].should be_a(String)
snapshot[:volume_id].should be_a(String)
end
it "should return proper attributes with params" do
actual = ec2.describe_snapshots([@snapshot_id])
actual.body[:snapshot_set].should be_an(Array)
snapshot = actual.body[:snapshot_set].select {|snapshot| snapshot[:snapshot_id] == @snapshot_id}.first
snapshot[:progress].should be_a(String)
snapshot[:snapshot_id].should be_a(String)
snapshot[:start_time].should be_a(Time)
snapshot[:status].should be_a(String)
snapshot[:volume_id].should be_a(String)
end
end end