Пример #1
0
    def test_reboot_not_applied(self, reboot_report, system):
        cfg = {}
        conduit = Mock()
        options = {'apply': False, 'minutes': 4}

        # test
        handler = LinuxHandler(cfg)
        report = handler.reboot(conduit, options)

        # validation
        reboot_report.assert_called_once_with()
        reboot_report.return_value.succeeded.assert_called_once_with()
        self.assertFalse(system.called)
        self.assertEqual(report, reboot_report.return_value)
Пример #2
0
    def test_reboot(self, reboot_report, system):
        cfg = {}
        conduit = Mock()
        options = {'apply': True, 'minutes': 4}

        # test
        handler = LinuxHandler(cfg)
        report = handler.reboot(conduit, options)

        # validation
        system.assert_called_once_with('shutdown -r +4')
        reboot_report.assert_called_once_with()
        reboot_report.return_value.set_succeeded.assert_called_once_with(
            dict(minutes=4))
        self.assertEqual(report, reboot_report.return_value)
Пример #3
0
    def test_reboot_not_applied(self, reboot_report, system):
        cfg = {}
        conduit = Mock()
        options = {
            'apply': False,
            'minutes': 4
        }

        # test
        handler = LinuxHandler(cfg)
        report = handler.reboot(conduit, options)

        # validation
        reboot_report.assert_called_once_with()
        reboot_report.return_value.succeeded.assert_called_once_with()
        self.assertFalse(system.called)
        self.assertEqual(report, reboot_report.return_value)
Пример #4
0
    def test_reboot(self, reboot_report, system):
        cfg = {}
        conduit = Mock()
        options = {
            'apply': True,
            'minutes': 4
        }

        # test
        handler = LinuxHandler(cfg)
        report = handler.reboot(conduit, options)

        # validation
        system.assert_called_once_with('shutdown -r +4')
        reboot_report.assert_called_once_with()
        reboot_report.return_value.set_succeeded.assert_called_once_with(dict(minutes=4))
        self.assertEqual(report, reboot_report.return_value)