Skip to content

Commit 61b08af

Browse files
test(hive): update mock to use _get_validated_metastore_connection for bot review
1 parent 6f6993e commit 61b08af

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

ingestion/tests/unit/topology/database/test_hive.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,18 +1353,19 @@ def test_no_partition_section_returns_false(self):
13531353

13541354
def test_metastore_connection_skips_detection(self):
13551355
"""When metastoreConnection is set, engine is never called."""
1356-
self.source.service_connection.metastoreConnection = Mock()
1357-
1358-
is_partitioned, partition = self.source.get_table_partition_details(
1359-
table_name="any_table",
1360-
schema_name="any_schema",
1361-
inspector=Mock(),
1362-
)
1356+
with patch.object(
1357+
self.source, "_get_validated_metastore_connection", return_value=Mock()
1358+
):
1359+
is_partitioned, partition = self.source.get_table_partition_details(
1360+
table_name="any_table",
1361+
schema_name="any_schema",
1362+
inspector=Mock(),
1363+
)
13631364

1364-
self.assertFalse(is_partitioned)
1365-
self.assertIsNone(partition)
1366-
# Engine must never be touched
1367-
self.source.engine.connect.assert_not_called()
1365+
self.assertFalse(is_partitioned)
1366+
self.assertIsNone(partition)
1367+
# Engine must never be touched
1368+
self.source.engine.connect.assert_not_called()
13681369

13691370
def test_engine_exception_returns_false(self):
13701371
"""Engine failure is caught gracefully, returns (False, None)."""

0 commit comments

Comments
 (0)