diff --git a/discoverx/discovery.py b/discoverx/discovery.py index d2b5c65..16b433d 100644 --- a/discoverx/discovery.py +++ b/discoverx/discovery.py @@ -293,8 +293,3 @@ def delete_by_class( if delete_result is not None: delete_result = delete_result.toPandas() logger.friendlyHTML(f"
The affected tables are
{delete_result.to_html()}") - - def save_scan(self): - """Method to save scan result""" - # TODO: - pass diff --git a/tests/unit/discovery_test.py b/tests/unit/discovery_test.py index 1e7f349..2b5f69e 100644 --- a/tests/unit/discovery_test.py +++ b/tests/unit/discovery_test.py @@ -1,5 +1,6 @@ import pytest from discoverx.explorer import DataExplorer, InfoFetcher +from discoverx.discovery import Discovery @pytest.fixture() @@ -14,6 +15,22 @@ def scan_ip_in_tb1(spark, info_fetcher): return discover +def test_noscan(spark, info_fetcher): + data_explorer = DataExplorer("*.*.tb_1", spark, info_fetcher) + discover = Discovery( + data_explorer._spark, + data_explorer._catalogs, + data_explorer._schemas, + data_explorer._tables, + data_explorer._info_fetcher.get_tables_info( + data_explorer._catalogs, data_explorer._schemas, data_explorer._tables, data_explorer._having_columns + ), + ) + with pytest.raises(Exception) as scan_first_error: + scan_result = discover.scan_result + assert scan_first_error.value.args[0] == "You first need to scan your lakehouse using Scanner.scan()" + + def test_discover_scan_msql(discover_ip): result = discover_ip._msql("SELECT [ip_v4] as ip FROM *.*.*").collect() assert {row.ip for row in result} == {"1.2.3.4", "3.4.5.60"} @@ -39,6 +56,13 @@ def test_discover_search(discover_ip): discover_ip.search(None) assert no_search_term_error.value.args[0] == "search_term has not been provided." + with pytest.raises(ValueError) as search_term_not_string_error: + discover_ip.search(7) + assert ( + search_term_not_string_error.value.args[0] + == "The search_term type