def test_list_queues(self, mock_hook): mock_hook.return_value.list_queues.return_value = mock.MagicMock() operator = CloudTasksQueuesListOperator(location=LOCATION, task_id="id") operator.execute(context=None) mock_hook.assert_called_once_with(gcp_conn_id=GCP_CONN_ID) mock_hook.return_value.list_queues.assert_called_once_with( location=LOCATION, project_id=None, results_filter=None, page_size=None, retry=None, timeout=None, metadata=None, )
def test_list_queues(self, mock_hook): mock_hook.return_value.list_queues.return_value = [TEST_QUEUE] operator = CloudTasksQueuesListOperator(location=LOCATION, 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.list_queues.assert_called_once_with( location=LOCATION, project_id=None, results_filter=None, page_size=None, retry=None, timeout=None, metadata=None, )