test_dhcp.py 文件源码

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

项目:maas 作者: maas 项目源码 文件源码
def test__does_log_other_exceptions_when_restarting(self):
        self.patch_sudo_write_file()
        self.patch_restartService().side_effect = (
            factory.make_exception("DHCP is on strike today"))
        failover_peers = [make_failover_peer_config()]
        shared_networks = fix_shared_networks_failover(
            [make_shared_network()], failover_peers)
        with FakeLogger("maas") as logger:
            with ExpectedException(exceptions.CannotConfigureDHCP):
                yield self.configure(
                    factory.make_name('key'),
                    failover_peers, shared_networks,
                    [make_host()], [make_interface()],
                    make_global_dhcp_snippets())
        self.assertDocTestMatches(
            "DHCPv... server failed to restart: "
            "DHCP is on strike today", logger.output)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号