Ejemplo n.º 1
0
def get_new_fake_client(*args, **kwargs):
    return ironic_utils.FakeClient()
Ejemplo n.º 2
0
    if updates:
        node.update(updates)
    return node


def fake_node_ext_status(**updates):
    node = fake_node(uuid='fake-uuid',
                     task_state='fake-task-state',
                     updated_at='fake-updated-at',
                     pxe_config_path='fake-pxe-config-path')
    if updates:
        node.update(updates)
    return node


FAKE_IRONIC_CLIENT = ironic_utils.FakeClient()


@mock.patch.object(b_nodes_v21, '_get_ironic_client',
                   lambda *_: FAKE_IRONIC_CLIENT)
class BareMetalNodesTestV21(test.NoDBTestCase):
    mod = b_nodes_v21

    def setUp(self):
        super(BareMetalNodesTestV21, self).setUp()

        self._setup()
        self.context = context.get_admin_context()
        self.request = FakeRequest(self.context)

    def _setup(self):
Ejemplo n.º 3
0
#    License for the specific language governing permissions and limitations
#    under the License.

from ironicclient import client as ironic_client
from ironicclient import exc as ironic_exception
import mock
from oslo_config import cfg

from nova import exception
from nova import test
from nova.tests.unit.virt.ironic import utils as ironic_utils
from nova.virt.ironic import client_wrapper

CONF = cfg.CONF

FAKE_CLIENT = ironic_utils.FakeClient()


def get_new_fake_client(*args, **kwargs):
    return ironic_utils.FakeClient()


class IronicClientWrapperTestCase(test.NoDBTestCase):
    def setUp(self):
        super(IronicClientWrapperTestCase, self).setUp()
        self.ironicclient = client_wrapper.IronicClientWrapper()
        # Do not waste time sleeping
        cfg.CONF.set_override('api_retry_interval', 0, 'ironic')

    @mock.patch.object(client_wrapper.IronicClientWrapper, '_multi_getattr')
    @mock.patch.object(client_wrapper.IronicClientWrapper, '_get_client')