Exemplo n.º 1
0
    def test_run_with_args(self):
        state = {}
        cronner = Cronner()

        @cronner.register('* * * * *')
        def fn(a, b):
            state.update(a=a, b=b)

        cronner.run('{}.{}'.format(fn.__module__, fn.__name__), 2, 3)
        self.assertEqual(state, {'a': 2, 'b': 3})
Exemplo n.º 2
0
    def test_run(self):
        state = {}
        cronner = Cronner()

        @cronner.register('* * * * *')
        def fn():
            state['a'] = 1

        cronner.run('{}.{}'.format(fn.__module__, fn.__name__))
        self.assertEqual(state, {'a': 1})