コード例 #1
0
 def test_pause_queue(self, mock_hook):
     mock_hook.return_value.pause_queue.return_value = {}
     operator = CloudTasksQueuePauseOperator(location=LOCATION,
                                             queue_name=QUEUE_ID,
                                             task_id="id")
     operator.execute(context=None)
     mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID)
     mock_hook.return_value.pause_queue.assert_called_once_with(
         location=LOCATION,
         queue_name=QUEUE_ID,
         project_id=None,
         retry=None,
         timeout=None,
         metadata=None,
     )
コード例 #2
0
ファイル: test_tasks.py プロジェクト: phucbui95/airflow
    def test_pause_queue(self, mock_hook):
        mock_hook.return_value.pause_queue.return_value = TEST_QUEUE
        operator = CloudTasksQueuePauseOperator(location=LOCATION,
                                                queue_name=QUEUE_ID,
                                                task_id="id")

        result = operator.execute(context=None)

        self.assertEqual({'name': FULL_QUEUE_PATH, 'state': 0}, result)
        mock_hook.assert_called_once_with(
            gcp_conn_id=GCP_CONN_ID,
            impersonation_chain=None,
        )
        mock_hook.return_value.pause_queue.assert_called_once_with(
            location=LOCATION,
            queue_name=QUEUE_ID,
            project_id=None,
            retry=None,
            timeout=None,
            metadata=None,
        )
コード例 #3
0
    delete_queue = CloudTasksQueueDeleteOperator(
        location=LOCATION,
        queue_name=QUEUE_ID,
        task_id="delete_queue",
    )

    resume_queue = CloudTasksQueueResumeOperator(
        location=LOCATION,
        queue_name=QUEUE_ID,
        task_id="resume_queue",
    )

    pause_queue = CloudTasksQueuePauseOperator(
        location=LOCATION,
        queue_name=QUEUE_ID,
        task_id="pause_queue",
    )

    purge_queue = CloudTasksQueuePurgeOperator(
        location=LOCATION,
        queue_name=QUEUE_ID,
        task_id="purge_queue",
    )

    get_queue = CloudTasksQueueGetOperator(
        location=LOCATION,
        queue_name=QUEUE_ID,
        task_id="get_queue",
    )