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)
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_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")
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")
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")