added tests for encrypted snapshots
This commit is contained in:
parent
a3c16bcc77
commit
2d73052eef
@ -182,6 +182,7 @@ def test_create_snapshot():
|
|||||||
snapshots.should.have.length_of(1)
|
snapshots.should.have.length_of(1)
|
||||||
snapshots[0].description.should.equal('a test snapshot')
|
snapshots[0].description.should.equal('a test snapshot')
|
||||||
snapshots[0].start_time.should_not.be.none
|
snapshots[0].start_time.should_not.be.none
|
||||||
|
snapshots[0].encrypted.should.be(False)
|
||||||
|
|
||||||
# Create snapshot without description
|
# Create snapshot without description
|
||||||
snapshot = volume.create_snapshot()
|
snapshot = volume.create_snapshot()
|
||||||
@ -198,6 +199,21 @@ def test_create_snapshot():
|
|||||||
cm.exception.request_id.should_not.be.none
|
cm.exception.request_id.should_not.be.none
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ec2
|
||||||
|
def test_create_encrypted_snapshot():
|
||||||
|
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||||
|
volume = conn.create_volume(80, "us-east-1a", encrypted=True)
|
||||||
|
snapshot = volume.create_snapshot('a test snapshot')
|
||||||
|
snapshot.update()
|
||||||
|
snapshot.status.should.equal('completed')
|
||||||
|
|
||||||
|
snapshots = conn.get_all_snapshots()
|
||||||
|
snapshots.should.have.length_of(1)
|
||||||
|
snapshots[0].description.should.equal('a test snapshot')
|
||||||
|
snapshots[0].start_time.should_not.be.none
|
||||||
|
snapshots[0].encrypted.should.be(True)
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_filter_snapshot_by_id():
|
def test_filter_snapshot_by_id():
|
||||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||||
@ -222,8 +238,8 @@ def test_filter_snapshot_by_id():
|
|||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_snapshot_filters():
|
def test_snapshot_filters():
|
||||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||||
volume1 = conn.create_volume(20, "us-east-1a")
|
volume1 = conn.create_volume(20, "us-east-1a", encrypted=False)
|
||||||
volume2 = conn.create_volume(25, "us-east-1a")
|
volume2 = conn.create_volume(25, "us-east-1a", encrypted=True)
|
||||||
|
|
||||||
snapshot1 = volume1.create_snapshot(description='testsnapshot1')
|
snapshot1 = volume1.create_snapshot(description='testsnapshot1')
|
||||||
snapshot2 = volume1.create_snapshot(description='testsnapshot2')
|
snapshot2 = volume1.create_snapshot(description='testsnapshot2')
|
||||||
@ -256,6 +272,9 @@ def test_snapshot_filters():
|
|||||||
snapshots_by_tag = conn.get_all_snapshots(filters={'tag:testkey1': 'testvalue1'})
|
snapshots_by_tag = conn.get_all_snapshots(filters={'tag:testkey1': 'testvalue1'})
|
||||||
set([snap.id for snap in snapshots_by_tag]).should.equal(set([snapshot1.id]))
|
set([snap.id for snap in snapshots_by_tag]).should.equal(set([snapshot1.id]))
|
||||||
|
|
||||||
|
snapshots_by_encrypted = conn.get_all_snapshots(filters={'encrypted': 'true'})
|
||||||
|
set([snap.id for snap in snapshots_by_encrypted]).should.equal(set([snapshot3.id]))
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_snapshot_attribute():
|
def test_snapshot_attribute():
|
||||||
@ -352,6 +371,21 @@ def test_create_volume_from_snapshot():
|
|||||||
new_volume.snapshot_id.should.equal(snapshot.id)
|
new_volume.snapshot_id.should.equal(snapshot.id)
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ec2
|
||||||
|
def test_create_volume_from_encrypted_snapshot():
|
||||||
|
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||||
|
volume = conn.create_volume(80, "us-east-1a", encrypted=True)
|
||||||
|
|
||||||
|
snapshot = volume.create_snapshot('a test snapshot')
|
||||||
|
snapshot.update()
|
||||||
|
snapshot.status.should.equal('completed')
|
||||||
|
|
||||||
|
new_volume = snapshot.create_volume('us-east-1a')
|
||||||
|
new_volume.size.should.equal(80)
|
||||||
|
new_volume.snapshot_id.should.equal(snapshot.id)
|
||||||
|
new_volume.encrypted.should.be(True)
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_modify_attribute_blockDeviceMapping():
|
def test_modify_attribute_blockDeviceMapping():
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user