def test__handle_updates_present_reboot_file_present(self, updates_needed, po, _reboot, apt):
"""
Given there are pending updates.
And Apt returns with 0
And Apt touches the /var/run/reboot-required file
A reboot will 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 = True
apt._handle()
assert po.called is True
assert _reboot.called is True
评论列表
文章目录