  def testListInstances(self, mock_ec2_api):
    """Test that instances of an account are correctly listed."""
    describe_instances = mock_ec2_api.return_value.describe_instances
    describe_instances.return_value = aws_mocks.MOCK_DESCRIBE_INSTANCES
    instances = aws_mocks.FAKE_AWS_ACCOUNT.ec2.ListInstances()
    self.assertEqual(1, len(instances))
    self.assertIn('fake-instance-id', instances)
    self.assertEqual('fake-zone-2', instances['fake-instance-id'].region)
    self.assertEqual(
        'fake-zone-2b', instances['fake-instance-id'].availability_zone)

    describe_instances.return_value = aws_mocks.MOCK_DESCRIBE_INSTANCES_TAGS
    instances = aws_mocks.FAKE_AWS_ACCOUNT.ec2.ListInstances()
    self.assertIn('fake-instance-with-name-id', instances)
    self.assertEqual(
        'fake-instance', instances['fake-instance-with-name-id'].name)
Test that instances of an account are correctly listed.
tests/providers/aws/internal/test_ec2.py