@@ -71,65 +71,106 @@ def test_command_unavailable_message_when_logging_not_available(
7171
7272 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
7373 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
74- @mock .patch ("snowflake.cli.api.config_ng.explain_configuration" )
74+ @mock .patch (
75+ "snowflake.cli.api.config_ng.resolution_logger.get_configuration_explanation_results"
76+ )
7577 def test_command_shows_summary_without_arguments (
76- self , mock_explain , mock_is_available , runner
78+ self , mock_get_results , mock_is_available , runner
7779 ):
7880 """Command should show configuration summary when called without arguments."""
81+ from snowflake .cli .api .output .types import CollectionResult
82+
7983 mock_is_available .return_value = True
84+ mock_get_results .return_value = CollectionResult ([])
8085 result = runner .invoke (["helpers" , COMMAND ])
8186 assert result .exit_code == 0
82- mock_explain .assert_called_once_with (key = None , verbose = False )
83- assert "Configuration resolution summary displayed above" in result .output
87+ mock_get_results .assert_called_once_with (key = None , verbose = False )
8488
8589 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
8690 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
87- @mock .patch ("snowflake.cli.api.config_ng.explain_configuration" )
88- def test_command_shows_specific_key (self , mock_explain , mock_is_available , runner ):
91+ @mock .patch (
92+ "snowflake.cli.api.config_ng.resolution_logger.get_configuration_explanation_results"
93+ )
94+ def test_command_shows_specific_key (
95+ self , mock_get_results , mock_is_available , runner
96+ ):
8997 """Command should show resolution for specific key when provided."""
98+ from snowflake .cli .api .output .types import CollectionResult
99+
90100 mock_is_available .return_value = True
101+ mock_get_results .return_value = CollectionResult ([])
91102 result = runner .invoke (["helpers" , COMMAND , "account" ])
92103 assert result .exit_code == 0
93- mock_explain .assert_called_once_with (key = "account" , verbose = False )
94- assert "Showing resolution for key: account" in result .output
104+ mock_get_results .assert_called_once_with (key = "account" , verbose = False )
95105
96106 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
97107 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
98- @mock .patch ("snowflake.cli.api.config_ng.explain_configuration" )
108+ @mock .patch (
109+ "snowflake.cli.api.config_ng.resolution_logger.get_configuration_explanation_results"
110+ )
99111 def test_command_shows_details_with_flag (
100- self , mock_explain , mock_is_available , runner
112+ self , mock_get_results , mock_is_available , runner
101113 ):
102114 """Command should show detailed resolution when --show-details flag is used."""
115+ from snowflake .cli .api .output .types import (
116+ CollectionResult ,
117+ MessageResult ,
118+ MultipleResults ,
119+ )
120+
103121 mock_is_available .return_value = True
122+ mock_get_results .return_value = MultipleResults (
123+ [CollectionResult ([]), MessageResult ("test history" )]
124+ )
104125 result = runner .invoke (["helpers" , COMMAND , "--show-details" ])
105126 assert result .exit_code == 0
106- mock_explain .assert_called_once_with (key = None , verbose = True )
107- assert "Configuration resolution summary displayed above" in result .output
127+ mock_get_results .assert_called_once_with (key = None , verbose = True )
108128
109129 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
110130 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
111- @mock .patch ("snowflake.cli.api.config_ng.explain_configuration" )
131+ @mock .patch (
132+ "snowflake.cli.api.config_ng.resolution_logger.get_configuration_explanation_results"
133+ )
112134 def test_command_shows_details_with_short_flag (
113- self , mock_explain , mock_is_available , runner
135+ self , mock_get_results , mock_is_available , runner
114136 ):
115137 """Command should show detailed resolution when -d flag is used."""
138+ from snowflake .cli .api .output .types import (
139+ CollectionResult ,
140+ MessageResult ,
141+ MultipleResults ,
142+ )
143+
116144 mock_is_available .return_value = True
145+ mock_get_results .return_value = MultipleResults (
146+ [CollectionResult ([]), MessageResult ("test history" )]
147+ )
117148 result = runner .invoke (["helpers" , COMMAND , "-d" ])
118149 assert result .exit_code == 0
119- mock_explain .assert_called_once_with (key = None , verbose = True )
150+ mock_get_results .assert_called_once_with (key = None , verbose = True )
120151
121152 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
122153 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
123- @mock .patch ("snowflake.cli.api.config_ng.explain_configuration" )
154+ @mock .patch (
155+ "snowflake.cli.api.config_ng.resolution_logger.get_configuration_explanation_results"
156+ )
124157 def test_command_shows_key_with_details (
125- self , mock_explain , mock_is_available , runner
158+ self , mock_get_results , mock_is_available , runner
126159 ):
127160 """Command should show detailed resolution for specific key."""
161+ from snowflake .cli .api .output .types import (
162+ CollectionResult ,
163+ MessageResult ,
164+ MultipleResults ,
165+ )
166+
128167 mock_is_available .return_value = True
168+ mock_get_results .return_value = MultipleResults (
169+ [CollectionResult ([]), MessageResult ("test history" )]
170+ )
129171 result = runner .invoke (["helpers" , COMMAND , "user" , "--show-details" ])
130172 assert result .exit_code == 0
131- mock_explain .assert_called_once_with (key = "user" , verbose = True )
132- assert "Showing resolution for key: user" in result .output
173+ mock_get_results .assert_called_once_with (key = "user" , verbose = True )
133174
134175 @mock .patch .dict (os .environ , {ALTERNATIVE_CONFIG_ENV_VAR : "1" }, clear = True )
135176 @mock .patch ("snowflake.cli.api.config_ng.is_resolution_logging_available" )
0 commit comments