Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1477)

Unified Diff: third_party/gsutil/third_party/boto/tests/unit/ec2/test_snapshot.py

Issue 1377933002: [catapult] - Copy Telemetry's gsutilz over to third_party. (Closed) Base URL: https://github.com/catapult-project/catapult.git@master
Patch Set: Rename to gsutil. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/gsutil/third_party/boto/tests/unit/ec2/test_snapshot.py
diff --git a/third_party/gsutil/third_party/boto/tests/unit/ec2/test_snapshot.py b/third_party/gsutil/third_party/boto/tests/unit/ec2/test_snapshot.py
new file mode 100644
index 0000000000000000000000000000000000000000..56af6bce36c9105a8913b90f1db29048b999b87b
--- /dev/null
+++ b/third_party/gsutil/third_party/boto/tests/unit/ec2/test_snapshot.py
@@ -0,0 +1,61 @@
+from tests.compat import OrderedDict
+from tests.unit import AWSMockServiceTestCase
+
+from boto.ec2.connection import EC2Connection
+from boto.ec2.snapshot import Snapshot
+
+
+class TestDescribeSnapshots(AWSMockServiceTestCase):
+
+ connection_class = EC2Connection
+
+ def default_body(self):
+ return b"""
+ <DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-01/">
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
+ <snapshotSet>
+ <item>
+ <snapshotId>snap-1a2b3c4d</snapshotId>
+ <volumeId>vol-1a2b3c4d</volumeId>
+ <status>pending</status>
+ <startTime>YYYY-MM-DDTHH:MM:SS.SSSZ</startTime>
+ <progress>30%</progress>
+ <ownerId>111122223333</ownerId>
+ <volumeSize>15</volumeSize>
+ <description>Daily Backup</description>
+ <tagSet>
+ <item>
+ <key>Purpose</key>
+ <value>demo_db_14_backup</value>
+ </item>
+ </tagSet>
+ <encrypted>false</encrypted>
+ </item>
+ </snapshotSet>
+ </DescribeSnapshotsResponse>
+ """
+
+ def test_describe_snapshots(self):
+ self.set_http_response(status_code=200)
+ response = self.service_connection.get_all_snapshots(['snap-1a2b3c4d', 'snap-9f8e7d6c'],
+ owner=['self', '111122223333'],
+ restorable_by='999988887777',
+ filters=OrderedDict((('status', 'pending'),
+ ('tag-value', '*db_*'))))
+ self.assert_request_parameters({
+ 'Action': 'DescribeSnapshots',
+ 'SnapshotId.1': 'snap-1a2b3c4d',
+ 'SnapshotId.2': 'snap-9f8e7d6c',
+ 'Owner.1': 'self',
+ 'Owner.2': '111122223333',
+ 'RestorableBy.1': '999988887777',
+ 'Filter.1.Name': 'status',
+ 'Filter.1.Value.1': 'pending',
+ 'Filter.2.Name': 'tag-value',
+ 'Filter.2.Value.1': '*db_*'},
+ ignore_params_values=['AWSAccessKeyId', 'SignatureMethod',
+ 'SignatureVersion', 'Timestamp',
+ 'Version'])
+ self.assertEqual(len(response), 1)
+ self.assertIsInstance(response[0], Snapshot)
+ self.assertEqual(response[0].id, 'snap-1a2b3c4d')

Powered by Google App Engine
This is Rietveld 408576698