@@ -1192,6 +1192,30 @@ def read_json_file_side_effect(filename):
1192
1192
assert result .exit_code != 0
1193
1193
assert "Authentication with 'tacacs+' is not allowed when passkey not exists." in result .output
1194
1194
1195
+ @mock .patch ('sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs' ,
1196
+ mock .MagicMock (return_value = ("dummy_path" , None )))
1197
+ def test_load_minigraph_no_yang_failure (self , get_cmd_module ):
1198
+ def is_file_side_effect (filename ):
1199
+ return True if 'golden_config' in filename else False
1200
+
1201
+ def read_json_file_side_effect (filename ):
1202
+ return {
1203
+ "NEW_FEATURE" : {
1204
+ "global" : {
1205
+ "state" : "enable"
1206
+ }
1207
+ }
1208
+ }
1209
+
1210
+ with mock .patch ("utilities_common.cli.run_command" , mock .MagicMock (side_effect = mock_run_command_side_effect )), \
1211
+ mock .patch ('os.path.isfile' , mock .MagicMock (side_effect = is_file_side_effect )), \
1212
+ mock .patch ('config.main.read_json_file' , mock .MagicMock (side_effect = read_json_file_side_effect )):
1213
+ (config , _ ) = get_cmd_module
1214
+ runner = CliRunner ()
1215
+ result = runner .invoke (config .config .commands ["load_minigraph" ], ["--override_config" , "-y" ])
1216
+ assert result .exit_code != 0
1217
+ assert "Config tables are missing yang models: dict_keys(['NEW_FEATURE'])" in result .output
1218
+
1195
1219
@mock .patch ('sonic_py_common.device_info.get_paths_to_platform_and_hwsku_dirs' , mock .MagicMock (return_value = ("dummy_path" , None )))
1196
1220
def test_load_minigraph_with_traffic_shift_away (self , get_cmd_module ):
1197
1221
with mock .patch ("utilities_common.cli.run_command" , mock .MagicMock (side_effect = mock_run_command_side_effect )) as mock_run_command :
0 commit comments