@@ -143,7 +143,11 @@ def test_add_new_relic(aws_credentials, mock_function_config):
143143 )
144144
145145 layer_selection_mock .assert_called_with (
146- mock_index .return_value , "java11" , "x86_64"
146+ mock_index .return_value ,
147+ "java11" ,
148+ "x86_64" ,
149+ upgrade = None ,
150+ existing_layer_arn = None ,
147151 )
148152 assert "original_handler" in config ["Configuration" ]["Handler" ]
149153
@@ -417,7 +421,6 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
417421
418422 runtime = "nodejs20.x"
419423
420- # --- Scenario 1: Standard Node.js Handler (ESM disabled) ---
421424 print (f"\n Testing Node.js ({ runtime } ) Standard Handler..." )
422425 original_std_handler = "original_handler"
423426 config_std = mock_function_config (runtime )
@@ -430,11 +433,16 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
430433 enable_extension_function_logs = True ,
431434 )
432435
433- update_kwargs_std = _add_new_relic (
434- install_opts_std ,
435- config_std ,
436- nr_license_key = nr_license_key ,
437- )
436+ with patch ("sys.stdout.isatty" ) as mock_isatty , patch (
437+ "newrelic_lambda_cli.layers.click.prompt"
438+ ) as mock_prompt :
439+ mock_isatty .return_value = True
440+ mock_prompt .return_value = 0
441+ update_kwargs_std = _add_new_relic (
442+ install_opts_std ,
443+ config_std ,
444+ nr_license_key = nr_license_key ,
445+ )
438446
439447 assert update_kwargs_std is not False , "Expected update_kwargs, not False"
440448 assert (
@@ -479,11 +487,16 @@ def test_add_new_relic_nodejs(aws_credentials, mock_function_config):
479487 esm = True ,
480488 )
481489
482- update_kwargs_esm = _add_new_relic (
483- install_opts_esm ,
484- config_esm ,
485- nr_license_key = nr_license_key ,
486- )
490+ with patch ("sys.stdout.isatty" ) as mock_isatty , patch (
491+ "newrelic_lambda_cli.layers.click.prompt"
492+ ) as mock_prompt :
493+ mock_isatty .return_value = True
494+ mock_prompt .return_value = 0
495+ update_kwargs_esm = _add_new_relic (
496+ install_opts_esm ,
497+ config_esm ,
498+ nr_license_key = nr_license_key ,
499+ )
487500
488501 assert update_kwargs_esm is not False , "Expected update_kwargs, not False"
489502 assert (
0 commit comments