  def testListImages(self):
    """End to end test on AWS.

    Test listing AMI images with a filter.
    """

    qfilter = 'ubuntu*'
    cmd = self.cli.PrepareListImagesCmd(self.zone, qfilter=qfilter)
    try:
      output = subprocess.check_output(
          cmd.split(), stderr=subprocess.STDOUT, shell=False)
    except subprocess.CalledProcessError as error:
      raise RuntimeError('Failed retrieving AMI images') from error
    if not output:
      raise RuntimeError('Could not find any images to list')
    logger.info(output)
    # For this function, the CLI tool only prints one line per result, or
    # nothing at all. Therefore if there's an output, there's a result.
    images = str(output).split('\n')
    self.assertGreater(len(images), 0)
    self.assertIn('Name', images[0])
End to end test on AWS.

Test listing AMI images with a filter.
tests/providers/aws/e2e_cli.py