def test_delete_job(self, remove_job, hdel, hget, hexists): change_request = { "action": "delete", "contract_id": "banana", "txn_type": "banana", "execution_order": "serial" } scheduler.worker(change_request) remove_job.assert_called_once() hdel.assert_called_once()
def test_update_job(self, mock_hset, mock_hget, reschedule_job, exists): change_request = { "action": "update", "contract_id": "banana", "execution_order": "serial", "txn_type": "banana", "seconds": 61 } scheduler.worker(change_request) reschedule_job.assert_called_with("whatever", trigger=ANY)
def test_create_new_job(self, hset, hexists): change_request = { "action": "create", "contract_id": "goo", "txn_type": "banana", "execution_order": "serial", "cron": "* * * * *" } scheduler.worker(change_request) hset.assert_called_with( "scheduler:params", "goo", '{"cron":"* * * * *","seconds":null,"contract_id":"goo","execution_order":"serial","txn_type":"banana"}' )