Sha256: 0a522de78ca24ebfa1b2242c2cee66108894340d94a8218f8bb9140b6e12fc78

Contents?: true

Size: 1.78 KB

Versions: 7

Compression:

Stored size: 1.78 KB

Contents

require File.dirname(__FILE__) + '/../../../spec_helper'

describe 'EC2.describe_snapshots' do
  describe 'success' do

    before(:all) do
      @volume_id = AWS[:ec2].create_volume('us-east-1a', 1).body['volumeId']
      AWS[:ec2].volumes.get(@volume_id).wait_for { ready? }
      @snapshot_id = AWS[:ec2].create_snapshot(@volume_id).body['snapshotId']
      AWS[:ec2].snapshots.get(@snapshot_id).wait_for { ready? }
    end

    after(:all) do
      AWS[:ec2].delete_volume(@volume_id)
      AWS[:ec2].delete_snapshot(@snapshot_id)
    end

    it "should return proper attributes with no params" do
      actual = AWS[:ec2].describe_snapshots
      actual.body['snapshotSet'].should be_an(Array)
      snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
      snapshot['progress'].should be_a(String)
      snapshot['snapshotId'].should be_a(String)
      snapshot['startTime'].should be_a(Time)
      snapshot['status'].should be_a(String)
      snapshot['volumeId'].should be_a(String)
    end
  
    it "should return proper attributes with params" do
      actual = AWS[:ec2].describe_snapshots([@snapshot_id])
      actual.body['snapshotSet'].should be_an(Array)
      snapshot = actual.body['snapshotSet'].select {|snapshot| snapshot['snapshotId'] == @snapshot_id}.first
      snapshot['progress'].should be_a(String)
      snapshot['snapshotId'].should be_a(String)
      snapshot['startTime'].should be_a(Time)
      snapshot['status'].should be_a(String)
      snapshot['volumeId'].should be_a(String)
    end

  end
  describe 'failure' do

    it "should raise a BadRequest error if the snapshot does not exist" do
      lambda {
        AWS[:ec2].describe_snapshots('snap-00000000')
      }.should raise_error(Excon::Errors::BadRequest)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.0.91 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.90 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.89 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.88 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.87 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.86 spec/aws/requests/ec2/describe_snapshots_spec.rb
fog-0.0.85 spec/aws/requests/ec2/describe_snapshots_spec.rb