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)
Exemple #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)
Exemple #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")
Exemple #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")
Exemple #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")
Exemple #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")
 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")
 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")