Skip to content

Commit

Permalink
✅ Added tests for validate_df param
Browse files Browse the repository at this point in the history
  • Loading branch information
burzecj committed Jan 16, 2024
1 parent d5904da commit 40382b6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/integration/flows/test_adls_to_azure_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,32 @@ def test_check_dtypes_sort():
assert False
except signals.FAIL:
assert True


def test_adls_to_azure_sql_mocked(TEST_CSV_FILE_PATH):
with mock.patch.object(ADLSToAzureSQL, "run", return_value=True) as mock_method:
instance = ADLSToAzureSQL(
name="test_adls_to_azure_sql_flow",
adls_path=TEST_CSV_FILE_PATH,
schema="sandbox",
table="test_bcp",
dtypes={"test_str": "VARCHAR(25)", "test_int": "INT"},
if_exists="replace",
)
instance.run()
mock_method.assert_called_with()


def test_adls_to_azure_sql_mocked_validate_df_param(TEST_CSV_FILE_PATH):
with mock.patch.object(ADLSToAzureSQL, "run", return_value=True) as mock_method:
instance = ADLSToAzureSQL(
name="test_adls_to_azure_sql_flow",
adls_path=TEST_CSV_FILE_PATH,
schema="sandbox",
table="test_bcp",
dtypes={"test_str": "VARCHAR(25)", "test_int": "INT"},
if_exists="replace",
validate_df_dict={"column_list_to_match": ["test_str", "test_int"]},
)
instance.run()
mock_method.assert_called_with()

0 comments on commit 40382b6

Please sign in to comment.