File: test_ec2.py

package info (click to toggle)
python-aiobotocore 2.25.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,524 kB
  • sloc: python: 15,437; makefile: 84
file content (26 lines) | stat: -rw-r--r-- 861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
async def test_ec2_snapshot(ec2_client):
    # TODO: this needs to somehow validate the presigned url sent because moto is not
    volume_response = await ec2_client.create_volume(
        AvailabilityZone="us-east-1", Size=10
    )
    tag_spec = [
        {
            "ResourceType": "snapshot",
            "Tags": [{"Key": "key", "Value": "value"}],
        }
    ]

    create_snapshot_response = await ec2_client.create_snapshot(
        VolumeId=volume_response["VolumeId"], TagSpecifications=tag_spec
    )

    copy_snapshot_response = await ec2_client.copy_snapshot(
        SourceSnapshotId=create_snapshot_response["SnapshotId"],
        SourceRegion="us-east-1",
        DestinationRegion="us-east-1",
        Encrypted=True,
        TagSpecifications=tag_spec,
        KmsKeyId="key-1234",
    )

    assert copy_snapshot_response['SnapshotId']