|
14 | 14 | add_remote_build_app_settings,
|
15 | 15 | remove_remote_build_app_settings,
|
16 | 16 | config_source_control,
|
17 |
| - validate_app_settings_in_scm) |
| 17 | + validate_app_settings_in_scm, |
| 18 | + update_container_settings_functionapp) |
18 | 19 | from azure.cli.core.profiles import ResourceType
|
19 | 20 | from azure.cli.core.azclierror import (AzureInternalError, UnclassifiedUserFault)
|
20 | 21 |
|
@@ -405,6 +406,35 @@ def test_validate_app_settings_in_scm_should_contain_failure(self, get_app_setti
|
405 | 406 | # assert
|
406 | 407 | self.assertFalse(result)
|
407 | 408 |
|
| 409 | + @mock.patch('azure.cli.command_modules.appservice.custom.is_centauri_functionapp') |
| 410 | + @mock.patch('azure.cli.command_modules.appservice.custom._generic_site_operation') |
| 411 | + @mock.patch('azure.cli.command_modules.appservice.custom.update_functionapp_polling', return_value=True) |
| 412 | + @mock.patch('azure.cli.command_modules.appservice.custom.update_container_settings', autospec=True) |
| 413 | + def test_update_container_settings_functionapp(self, |
| 414 | + update_container_settings_mock, |
| 415 | + update_functionapp_polling_mock, |
| 416 | + site_op_mock, |
| 417 | + is_centauri_functionapp_mock): |
| 418 | + # prepare |
| 419 | + cmd_mock = _get_test_cmd() |
| 420 | + cli_ctx_mock = mock.MagicMock() |
| 421 | + cmd_mock.cli_ctx = cli_ctx_mock |
| 422 | + |
| 423 | + Site, DaprConfig, ResourceConfig = cmd_mock.get_models('Site', 'DaprConfig', 'ResourceConfig') |
| 424 | + site = Site(dapr_config=None, location='westus', name='name', resource_config=ResourceConfig()) |
| 425 | + site_op_mock.return_value = site |
| 426 | + |
| 427 | + is_centauri_functionapp_mock.return_value = True |
| 428 | + |
| 429 | + # action |
| 430 | + update_container_settings_functionapp(cmd_mock, 'rg', 'name', workload_profile_name='d4', cpu=0.5, memory='1Gi') |
| 431 | + |
| 432 | + # assert |
| 433 | + updated_site = site |
| 434 | + updated_site.dapr_config = DaprConfig() |
| 435 | + update_functionapp_polling_mock.assert_called_with(cmd_mock, 'rg', 'name', updated_site) |
| 436 | + |
| 437 | + |
408 | 438 | @mock.patch('azure.cli.command_modules.appservice.custom.validate_app_settings_in_scm', return_value=True)
|
409 | 439 | @mock.patch('azure.cli.command_modules.appservice.custom.update_app_settings')
|
410 | 440 | @mock.patch('azure.cli.command_modules.appservice.custom.delete_app_settings')
|
|
0 commit comments