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 })
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})
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})
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} )