  def testCreateVolumeFromSnapshot(self, mock_ec2_api):
    """Test the creation of a volume from a snapshot."""
    caller_identity = mock_ec2_api.return_value.get_caller_identity
    mock_ec2_api.return_value.create_volume.return_value = aws_mocks.MOCK_CREATE_VOLUME
    caller_identity.return_value = aws_mocks.MOCK_CALLER_IDENTITY

    # CreateVolumeFromSnapshot(
    #     Snapshot=aws_mocks.FAKE_SNAPSHOT, volume_name=None,
    #     volume_name_prefix='')
    volume_from_snapshot = aws_mocks.FAKE_AWS_ACCOUNT.ebs.CreateVolumeFromSnapshot(
        aws_mocks.FAKE_SNAPSHOT)
    self.assertIsInstance(volume_from_snapshot, ebs.AWSVolume)
    self.assertEqual(
        'fake-volume-from-snapshot-id', volume_from_snapshot.volume_id)
    self.assertEqual('fake-snapshot-d69d57c3-copy', volume_from_snapshot.name)

    # CreateVolumeFromSnapshot(
    #     Snapshot=aws_mocks.FAKE_SNAPSHOT,
    #     volume_name='new-forensics-volume',
    #     volume_name_prefix='')
    volume_from_snapshot = aws_mocks.FAKE_AWS_ACCOUNT.ebs.CreateVolumeFromSnapshot(
        aws_mocks.FAKE_SNAPSHOT, volume_name='new-forensics-volume')
    self.assertIsInstance(volume_from_snapshot, ebs.AWSVolume)
    self.assertEqual(
        'fake-volume-from-snapshot-id', volume_from_snapshot.volume_id)
    self.assertEqual('new-forensics-volume', volume_from_snapshot.name)

    # CreateVolumeFromSnapshot(
    #     Snapshot=aws_mocks.FAKE_SNAPSHOT, volume_name=None,
    #     volume_name_prefix='prefix')
    volume_from_snapshot = aws_mocks.FAKE_AWS_ACCOUNT.ebs.CreateVolumeFromSnapshot(
        aws_mocks.FAKE_SNAPSHOT, volume_name_prefix='prefix')
    self.assertIsInstance(volume_from_snapshot, ebs.AWSVolume)
    self.assertEqual(
        'fake-volume-from-snapshot-id', volume_from_snapshot.volume_id)
    self.assertEqual(
        'prefix-fake-snapshot-d69d57c3-copy', volume_from_snapshot.name)

    with self.assertRaises(ValueError) as error:
      aws_mocks.FAKE_AWS_ACCOUNT.ebs.CreateVolumeFromSnapshot(
          aws_mocks.FAKE_SNAPSHOT, volume_type='invalid-volume-type')
    self.assertEqual('Volume type must be one of [standard, io1, gp2, gp3, sc1, '
                     'st1]. Got: invalid-volume-type', str(error.exception))
Test the creation of a volume from a snapshot.
tests/providers/aws/internal/test_ebs.py