test_packagemanager.py 文件源码

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

项目:DeepSea 作者: SUSE 项目源码 文件源码
def test__handle_updates_present_reboot_file_not_present(self, updates_needed, po, _reboot, apt):      
        """
        Given there are pending updates.
        And Apt returns with 0
        And Apt does not touch the /var/run/reboot-required file
        Then no reboot should be  triggered
        """
        updates_needed.return_value = True
        po.return_value.communicate.return_value = ("packages out", "error")
        po.return_value.returncode = 0
        with patch("srv.salt._modules.packagemanager.os.path.isfile") as mock_file:
            mock_file.return_value = False
            apt._handle()
            assert po.called is True
            assert _reboot.called is False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号