Ejemplo n.º 1
0
 def test_init_regex(self):
     cls = Job('jname', 'schedname', summary_regex='foobar')
     assert cls._name == 'jname'
     assert cls._schedule_name == 'schedname'
     assert cls._started is False
     assert cls._finished is False
     assert cls._exit_code is None
     assert cls._output is None
     assert cls._start_time is None
     assert cls._finish_time is None
     assert cls._summary_regex == 'foobar'
     assert cls._skip_reason is None
     assert cls._cron_expression is None
Ejemplo n.º 2
0
 def test_init_cronex_skip(self):
     m_cronex = Mock()
     m_cronex.check_trigger.return_value = False
     with patch('%s.CronExpression' % pbm) as mock_cronex:
         mock_cronex.return_value = m_cronex
         cls = Job('jname', 'schedname', cron_expression='foo')
     assert cls._name == 'jname'
     assert cls._schedule_name == 'schedname'
     assert cls._started is False
     assert cls._finished is False
     assert cls._exit_code is None
     assert cls._output is None
     assert cls._start_time is None
     assert cls._finish_time is None
     assert cls._summary_regex is None
     assert cls._cron_expression == m_cronex
     assert mock_cronex.mock_calls == [
         call('foo'),
         call().check_trigger((2017, 11, 26, 13, 45))
     ]
     assert m_cronex.mock_calls == [
         call.check_trigger((2017, 11, 26, 13, 45))
     ]
     assert cls._skip_reason == 'cronex: "foo"'
Ejemplo n.º 3
0
 def setup(self):
     self.cls = Job('jname', 'schedname')