def test_probe_and_enlist_msftocs_probes_and_enlists(self):
context = make_context()
user = factory.make_name('user')
system_id = factory.make_name('system_id')
domain = factory.make_name('domain')
macs = [factory.make_mac_address() for _ in range(3)]
mock_get_blades = self.patch(MicrosoftOCSPowerDriver, "get_blades")
mock_get_blades.return_value = {'%s' % context['blade_id']: macs}
self.patch(MicrosoftOCSPowerDriver, "set_next_boot_device")
mock_create_node = self.patch(msftocs_module, "create_node")
mock_create_node.side_effect = asynchronous(lambda *args: system_id)
mock_commission_node = self.patch(msftocs_module, "commission_node")
yield deferToThread(
probe_and_enlist_msftocs, user, context['power_address'],
int(context['power_port']), context['power_user'],
context['power_pass'], True, domain)
self.expectThat(
mock_create_node, MockCalledOnceWith(
macs, 'amd64', 'msftocs', context, domain))
self.expectThat(
mock_commission_node, MockCalledOnceWith(system_id, user))
评论列表
文章目录