add most of the snapshot implementation

This commit is contained in:
Steve Pulec 2013-02-23 18:01:41 -05:00
commit e261b82f29
4 changed files with 109 additions and 4 deletions

View file

@ -48,3 +48,25 @@ def test_volume_attach_and_detach():
volume.volume_state().should.equal('available')
conn.detach_volume.when.called_with(volume.id, instance.id, "/dev/sdh").should.throw(EC2ResponseError)
@mock_ec2
def test_create_snapshot():
conn = boto.connect_ec2('the_key', 'the_secret')
volume = conn.create_volume(80, "us-east-1a")
volume.create_snapshot('a test snapshot')
snapshots = conn.get_all_snapshots()
snapshots.should.have.length_of(1)
snapshots[0].description.should.equal('a test snapshot')
# Create snapshot without description
snapshot = volume.create_snapshot()
conn.get_all_snapshots().should.have.length_of(2)
snapshot.delete()
conn.get_all_snapshots().should.have.length_of(1)
# Deleting something that was already deleted should throw an error
snapshot.delete.when.called_with().should.throw(EC2ResponseError)