class_docstr: tests for caliban.platform.gke.util
class_docstr_tok: ["tests","for","caliban.platform.gke.util"]
docstr: test get_zones_in_region
code: def test_get_zones_in_region(self, region, zone_ids):
      """test get_zones_in_region"""
  
      class mock_api:
          def regions(self):
              return self
  
          def get(self, project, region):
              return self
  
      def _raises():
          raise Exception("exception")
  
      url = "https://www.googleapis.com/compute/v1/projects/foo/zones/"
      zones = ["{}-{}".format(region, x) for x in zone_ids]
  
      def _normal():
          return {"zones": ["{}{}".format(url, x) for x in zones]}
  
      def _invalid():
          return {"foo": "bar"}
  
      api = mock_api()
  
      # exception handling
      api.execute = _raises
      self.assertIsNone(util.get_zones_in_region(api, "p", region))
  
      # invalid return
      api.execute = _invalid
      self.assertIsNone(util.get_zones_in_region(api, "p", region))
  
      # normal execution
      api.execute = _normal
      self.assertEqual(
          zones, util.get_zones_in_region(api, "p", region)
      )
  
imports: import random
  import unittest
  from typing import List, Optional, Dict
  from unittest import mock
  import uuid
  import json
  import os
  import tempfile
  import yaml
  import hypothesis.strategies
  from hypothesis import given, settings
  from kubernetes.client.api_client import ApiClient
  from kubernetes.client import V1Job
  import pytest
  import argparse
  import google
  import caliban.platform.cloud.types
  import caliban.platform.gke.constants
  import caliban.platform.gke.util
  from caliban.platform.gke.types import NodeImage, OpStatus
  from caliban.platform.gke.util import trap
label_desc: Use image node_id 17 for calling the UtilTestSuite obj's underlying member method code with example usage: obj.test_get_zones_in_region(region, zone_ids) and returns: dict, dict, self, self