  def testGetVolumesByNameOrId(self, mock_list_volumes):
    """Test that a volume of an account can be found by its name or ID."""
    mock_list_volumes.return_value = aws_mocks.MOCK_LIST_VOLUMES
    found_volumes = aws_mocks.FAKE_AWS_ACCOUNT.ebs.GetVolumesByNameOrId(
        volume_id=aws_mocks.FAKE_VOLUME.volume_id)
    self.assertEqual(1, len(found_volumes))
    self.assertEqual('fake-volume-id', found_volumes[0].volume_id)

    found_volumes = aws_mocks.FAKE_AWS_ACCOUNT.ebs.GetVolumesByNameOrId(
        volume_name=aws_mocks.FAKE_BOOT_VOLUME.name)
    self.assertEqual(1, len(found_volumes))
    self.assertEqual(
        'fake-boot-volume-id', found_volumes[0].volume_id)

    with self.assertRaises(ValueError):
      aws_mocks.FAKE_AWS_ACCOUNT.ebs.GetVolumesByNameOrId()

    with self.assertRaises(ValueError):
      aws_mocks.FAKE_AWS_ACCOUNT.ebs.GetVolumesByNameOrId(
          volume_id=aws_mocks.FAKE_VOLUME.volume_id,
          volume_name=aws_mocks.FAKE_BOOT_VOLUME.name)
Test that a volume of an account can be found by its name or ID.
tests/providers/aws/internal/test_ebs.py