def test_get_heat_api_version_check_result(self): API = 'HEAT_API_VERSION' expected_result = '2' with mock.patch.dict('os.environ', {API: '2'}, clear=True): api_version = openstack_utils.get_heat_api_version() self.assertEqual(api_version, expected_result)
def heat_client(self): """returns a heat client instance""" if self._heat_client is None: sess = op_utils.get_session() heat_endpoint = op_utils.get_endpoint(service_type='orchestration') self._heat_client = heatclient.client.Client( op_utils.get_heat_api_version(), endpoint=heat_endpoint, session=sess) return self._heat_client
def test_get_heat_api_version(self, mock_os): mock_os.getenv.return_value = ('2') expected_result = '2' api_version = openstack_utils.get_heat_api_version() self.assertEqual(api_version, expected_result)
def test_get_heat_api_version(self, mock_os): API = 'HEAT_API_VERSION' openstack_utils.get_heat_api_version() mock_os.getenv.assert_called_with(API)