Files
python-tripleoclient/tripleoclient/tests/v1/baremetal/fakes.py
Kevin Carter 7c40575d7b Update client to create archive and use tripleo-common
The client utils will now run a new playbook to ensure that the local
archive directory is created early in the deployment process. This
change will allow us to build toward a swift-less deployment. All of
the client calls, save one, has been moved to use tripleo-common which
will assist us to better manage, and migrate from swift storage to a
local archive.

> As a product of this change all of the "webhook" calls have been
  removed. which was deprecated as part of the Zaqar and Mistral work.
  These calls were removed because several swift calls were tied into
  them, and because mistral is no longer part of the stack, and has
  been gone for a few cycles, we can safely remove these calls which
  do nothing.

Depends-On: Ibe9b2ffe94cdf493fc84366979d1d78b8528ea1b
Change-Id: I7531612a49527f8a21df415c648acb41ac7a0b10
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2021-01-20 09:43:52 -06:00

71 lines
2.1 KiB
Python

# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
import ironic_inspector_client
from osc_lib.tests import utils
class FakeInspectorClient(object):
def __init__(self, states=None, data=None):
self.states = states or {}
self.data = data or {}
self.on_introspection = []
def introspect(self, uuid):
self.on_introspection.append(uuid)
def get_status(self, uuid):
try:
return self.states[uuid]
except KeyError:
raise ironic_inspector_client.ClientError(mock.Mock())
def get_data(self, uuid):
try:
return self.data[uuid]
except KeyError:
raise ironic_inspector_client.ClientError(mock.Mock())
def wait_for_finish(self, uuids):
return {uuid: self.states[uuid] for uuid in uuids}
class ClientWrapper(object):
def __init__(self):
self._instance = None
class TestBaremetal(utils.TestCommand):
def setUp(self):
super(TestBaremetal, self).setUp()
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
self.app.client_manager.baremetal = mock.Mock()
self.app.client_manager.image = mock.Mock()
self.app.client_manager.baremetal_introspection = FakeInspectorClient()
self.app.client_manager._region_name = "Arcadia"
self.app.client_manager.session = mock.Mock()
self.app.client_manager.workflow_engine = mock.Mock()
self.app.client_manager.tripleoclient = ClientWrapper()
def tearDown(self):
super(TestBaremetal, self).tearDown()
mock.patch.stopall()