Ejemplo n.º 1
0
 def test_save(self):
     '''
     Test if it save all scheduled jobs on the minion.
     '''
     comm1 = 'Schedule (non-pillar items) saved to ///schedule.conf.'
     with patch.dict(schedule.__opts__, {
             'config_dir': '',
             'schedule': {},
             'default_include': '/tmp'
     }):
         self.assertDictEqual(schedule.save(), {
             'comment': comm1,
             'result': True
         })
Ejemplo n.º 2
0
    def test_save(self):
        '''
        Test if it save all scheduled jobs on the minion.
        '''
        comm1 = 'Schedule (non-pillar items) saved.'
        with patch.dict(schedule.__opts__, {'schedule': {},
                                            'default_include': '/tmp',
                                            'sock_dir': self.sock_dir}):

            mock = MagicMock(return_value=True)
            with patch.dict(schedule.__salt__, {'event.fire': mock}):
                _ret_value = {'complete': True, 'schedule': {}}
                with patch.object(SaltEvent, 'get_event', return_value=_ret_value):
                    self.assertDictEqual(schedule.save(),
                                         {'comment': comm1, 'result': True})
Ejemplo n.º 3
0
    def test_save(self):
        '''
        Test if it save all scheduled jobs on the minion.
        '''
        comm1 = 'Schedule (non-pillar items) saved.'
        with patch.dict(schedule.__opts__, {'config_dir': '', 'schedule': {},
                                            'default_include': '/tmp',
                                            'sock_dir': SOCK_DIR}):

            mock = MagicMock(return_value=True)
            with patch.dict(schedule.__salt__, {'event.fire': mock}):
                _ret_value = {'complete': True, 'schedule': {}}
                with patch.object(SaltEvent, 'get_event', return_value=_ret_value):
                    self.assertDictEqual(schedule.save(),
                                         {'comment': comm1, 'result': True})
Ejemplo n.º 4
0
    def test_save(self):
        """
        Test if it save all scheduled jobs on the minion.
        """
        comm1 = "Schedule (non-pillar items) saved."
        with patch.dict(
            schedule.__opts__,
            {"schedule": {}, "default_include": "/tmp", "sock_dir": self.sock_dir},
        ):

            mock = MagicMock(return_value=True)
            with patch.dict(schedule.__salt__, {"event.fire": mock}):
                _ret_value = {"complete": True, "schedule": {}}
                with patch.object(SaltEvent, "get_event", return_value=_ret_value):
                    self.assertDictEqual(
                        schedule.save(), {"comment": comm1, "result": True}
                    )