#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations

from unittest import mock

from airflow.providers.google.marketing_platform.sensors.bid_manager import (
    GoogleBidManagerRunQuerySensor,
)

MODULE_NAME = "airflow.providers.google.marketing_platform.sensors.bid_manager"

GCP_CONN_ID = "google_cloud_default"


class TestGoogleBidManagerRunQuerySensor:
    @mock.patch(f"{MODULE_NAME}.GoogleBidManagerHook")
    @mock.patch(f"{MODULE_NAME}.BaseSensorOperator")
    def test_poke(self, mock_base_op, hook_mock):
        query_id = "QUERY_ID"
        report_id = "REPORT_ID"
        op = GoogleBidManagerRunQuerySensor(query_id=query_id, report_id=report_id, task_id="test_task")
        op.poke(context=None)
        hook_mock.assert_called_once_with(
            gcp_conn_id=GCP_CONN_ID,
            api_version="v2",
            impersonation_chain=None,
        )
        hook_mock.return_value.get_report.assert_called_once_with(query_id=query_id, report_id=report_id)
