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
评论列表
文章目录