def test_should_expire_overdue_runs(self, mock_get_overdue_runs):
        node_line_item_run = NodeLineItemRunFactory()
        mock_get_overdue_runs.return_value = [node_line_item_run]

        expire_overdue_runs()

        mock_get_overdue_runs.assert_called()
        self.assertEqual(node_line_item_run.status, NodeLineItemRun.STATUS.expired)
示例#2
0
    def test_should_expire_overdue_runs(self, mock_get_overdue_runs):
        run = RunFactory()
        mock_get_overdue_runs.return_value = [run]

        expire_overdue_runs()

        mock_get_overdue_runs.assert_called()
        self.assertEqual(run.status, Run.STATUS.expired)
示例#3
0
    def test_should_schedule_queued_runs_for_a_consignee_after_expiring_over_due_runs(
        self, mock_get_overdue_runs, mock_schedule_run_for, mock_deque
    ):
        overdue_run = RunFactory(node=self.node)
        node = DistributionPlanNodeFactory()
        run_queue_item = RunQueueFactory(node=node, contact_person_id=self.node.contact_person_id)

        mock_get_overdue_runs.return_value = [overdue_run]
        mock_schedule_run_for.return_value = None
        mock_deque.return_value = run_queue_item

        expire_overdue_runs()

        mock_deque.assert_called_with(self.node.contact_person_id)
        mock_schedule_run_for.assert_called_with(run_queue_item.node)
        self.assertEqual(run_queue_item.status, RunQueue.STATUS.started)