Пример #1
0
    def test_remove_snapshot(self):
        snaps = [{'SnapshotId': 'a'}, {'SnapshotId': 'b'}, {'SnapshotId': 'c'}]

        t1 = list(snaps)
        ErrorHandler.remove_snapshot('c', t1)
        self.assertEqual([t['SnapshotId'] for t in t1], ['a', 'b'])

        ErrorHandler.remove_snapshot('d', snaps)
        self.assertEqual(len(snaps), 3)
Пример #2
0
    def test_remove_snapshot(self):
        snaps = [{'SnapshotId': 'a'}, {'SnapshotId': 'b'}, {'SnapshotId': 'c'}]

        t1 = list(snaps)
        ErrorHandler.remove_snapshot('c', t1)
        self.assertEqual([t['SnapshotId'] for t in t1], ['a', 'b'])

        ErrorHandler.remove_snapshot('d', snaps)
        self.assertEqual(len(snaps), 3)
Пример #3
0
 def test_get_bad_snapshot_malformed(self):
     operation_name = "DescribeSnapshots"
     error_response = {
         "Error": {
             "Message": 'Invalid id: "snap-malformedsnap"',
             "Code": "InvalidSnapshotID.Malformed",
         }
     }
     e = ClientError(error_response, operation_name)
     snap = ErrorHandler.extract_bad_snapshot(e)
     self.assertEqual(snap, "snap-malformedsnap")
Пример #4
0
 def test_get_bad_volume_notfound(self):
     operation_name = "DescribeVolumes"
     error_response = {
         "Error": {
             "Message": "The volume 'vol-notfound' does not exist.",
             "Code": "InvalidVolume.NotFound",
         }
     }
     e = ClientError(error_response, operation_name)
     vol = ErrorHandler.extract_bad_volume(e)
     self.assertEqual(vol, "vol-notfound")
Пример #5
0
 def test_get_bad_volume_malformed(self):
     operation_name = "DescribeVolumes"
     error_response = {
         "Error": {
             "Message": 'Invalid id: "vol-malformedvolume"',
             "Code": "InvalidVolumeID.Malformed",
         }
     }
     e = ClientError(error_response, operation_name)
     vol = ErrorHandler.extract_bad_volume(e)
     self.assertEqual(vol, "vol-malformedvolume")
Пример #6
0
 def test_get_bad_snapshot_notfound(self):
     operation_name = "DescribeSnapshots"
     error_response = {
         "Error": {
             "Message": "The snapshot 'snap-notfound' does not exist.",
             "Code": "InvalidSnapshot.NotFound",
         }
     }
     e = ClientError(error_response, operation_name)
     snap = ErrorHandler.extract_bad_snapshot(e)
     self.assertEqual(snap, "snap-notfound")
Пример #7
0
 def test_get_bad_snapshot_malformed(self):
     operation_name = "DescribeSnapshots"
     error_response = {
         "Error": {
             "Message": 'Invalid id: "snap-malformedsnap"',
             "Code": "InvalidSnapshotID.Malformed",
         }
     }
     e = ClientError(error_response, operation_name)
     snap = ErrorHandler.extract_bad_snapshot(e)
     self.assertEqual(snap, "snap-malformedsnap")
Пример #8
0
 def test_get_bad_snapshot_notfound(self):
     operation_name = "DescribeSnapshots"
     error_response = {
         "Error": {
             "Message": "The snapshot 'snap-notfound' does not exist.",
             "Code": "InvalidSnapshot.NotFound",
         }
     }
     e = ClientError(error_response, operation_name)
     snap = ErrorHandler.extract_bad_snapshot(e)
     self.assertEqual(snap, "snap-notfound")