dcoliversun commented on code in PR #31787: URL: https://github.com/apache/airflow/pull/31787#discussion_r1235057307
########## tests/providers/alibaba/cloud/hooks/test_analyticdb_spark.py: ########## @@ -0,0 +1,193 @@ +# +# 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 alibabacloud_adb20211201.models import ( + GetSparkAppLogResponse, + GetSparkAppLogResponseBody, + GetSparkAppLogResponseBodyData, + GetSparkAppStateResponse, + GetSparkAppStateResponseBody, + GetSparkAppStateResponseBodyData, + GetSparkAppWebUiAddressResponse, + GetSparkAppWebUiAddressResponseBody, + GetSparkAppWebUiAddressResponseBodyData, + KillSparkAppResponse, + SubmitSparkAppResponse, +) + +from airflow.providers.alibaba.cloud.hooks.analyticdb_spark import AnalyticDBSparkHook +from tests.providers.alibaba.cloud.utils.analyticdb_spark_mock import mock_adb_spark_hook_default_project_id + +ADB_SPARK_STRING = "airflow.providers.alibaba.cloud.hooks.analyticdb_spark.{}" +MOCK_ADB_SPARK_CONN_ID = "mock_id" +MOCK_ADB_CLUSTER_ID = "mock_adb_cluster_id" +MOCK_ADB_RG_NAME = "mock_adb_rg_name" +MOCK_ADB_SPARK_ID = "mock_adb_spark_id" + + +class TestAnalyticDBSparkHook: + def setup_method(self): + with mock.patch( + ADB_SPARK_STRING.format("AnalyticDBSparkHook.__init__"), + new=mock_adb_spark_hook_default_project_id, + ): + self.hook = AnalyticDBSparkHook(adb_spark_conn_id=MOCK_ADB_SPARK_CONN_ID) + + def test_build_submit_app_data(self): + res_data = self.hook.build_submit_app_data( Review Comment: All test add docstring -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
