potiuk commented on code in PR #39831: URL: https://github.com/apache/airflow/pull/39831#discussion_r1615142134
########## tests/integration/providers/google/cloud/transfers/test_mssql_to_gcs.py: ########## @@ -17,102 +17,65 @@ # under the License. from __future__ import annotations -import datetime +import os from unittest import mock import pytest -try: - from airflow.providers.google.cloud.transfers.mssql_to_gcs import MSSQLToGCSOperator -except ImportError: - pytest.skip("MSSQL not available", allow_module_level=True) +from airflow.providers.google.cloud.transfers.mssql_to_gcs import MSSQLToGCSOperator +from airflow.providers.microsoft.mssql.hooks.mssql import MsSqlHook +AIRFLOW_CONN_MSSQL_DEFAULT = "mssql://sa:airflow123@mssql:1433/" TASK_ID = "test-mssql-to-gcs" -MSSQL_CONN_ID = "mssql_conn_test" -SQL = "select 1" +TEST_TABLE_ID = "test_table_id" +MSSQL_CONN_ID = "mssql_default" BUCKET = "gs://test" JSON_FILENAME = "test_{}.ndjson" GZIP = False -ROWS = [ - ("mock_row_content_1", 42, True, True), - ("mock_row_content_2", 43, False, False), - ("mock_row_content_3", 44, True, True), -] -CURSOR_DESCRIPTION = ( - ("some_str", 0, None, None, None, None, None), - ("some_num", 3, None, None, None, None, None), - ("some_binary", 2, None, None, None, None, None), - ("some_bit", 3, None, None, None, None, None), -) NDJSON_LINES = [ - b'{"some_binary": true, "some_bit": true, "some_num": 42, "some_str": "mock_row_content_1"}\n', - b'{"some_binary": false, "some_bit": false, "some_num": 43, "some_str": "mock_row_content_2"}\n', - b'{"some_binary": true, "some_bit": true, "some_num": 44, "some_str": "mock_row_content_3"}\n', -] -SCHEMA_FILENAME = "schema_test.json" -SCHEMA_JSON = [ - b'[{"mode": "NULLABLE", "name": "some_str", "type": "STRING"}, ', - b'{"mode": "NULLABLE", "name": "some_num", "type": "INTEGER"}, ', - b'{"mode": "NULLABLE", "name": "some_binary", "type": "BOOLEAN"}, ', - b'{"mode": "NULLABLE", "name": "some_bit", "type": "BOOLEAN"}]', -] - -SCHEMA_JSON_BIT_FIELDS = [ - b'[{"mode": "NULLABLE", "name": "some_str", "type": "STRING"}, ', - b'{"mode": "NULLABLE", "name": "some_num", "type": "INTEGER"}, ', - b'{"mode": "NULLABLE", "name": "some_binary", "type": "BOOLEAN"}, ', - b'{"mode": "NULLABLE", "name": "some_bit", "type": "INTEGER"}]', + b'{"Address": "1000 N West Street, Suite 1200", "City": "Wilmington, NC, USA", "FirstName": "Apache",' + b' "LastName": "Airflow", "PersonID": 0}\n', ] -@pytest.mark.skip(reason="FIXME: Supposed to use 'mssql' integration which is not implemented yet.") @pytest.mark.integration("mssql") class TestMsSqlToGoogleCloudStorageOperator: - @pytest.mark.parametrize( - "value, expected", - [ - ("string", "string"), - (32.9, 32.9), - (-2, -2), - (datetime.date(1970, 1, 2), "1970-01-02"), - (datetime.date(1000, 1, 2), "1000-01-02"), - (datetime.datetime(1970, 1, 1, 1, 0), "1970-01-01T01:00:00"), - (datetime.time(hour=0, minute=0, second=0), "00:00:00"), - (datetime.time(hour=23, minute=59, second=59), "23:59:59"), - ], - ) - def test_convert_type(self, value, expected): + def setup_method(self): Review Comment: I think those tests should be moved to "mssql" provider. There is no particular reason they should be in "google" provider if they are change into integration tests. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org