test_msftocs.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号