def test_app_service_environment_update(self, ase_client_factory_mock,
                                            resource_group_mock):
        ase_name = 'mock_ase_name'
        rg_name = 'mock_rg_name'

        ase_client = mock.MagicMock()
        ase_client_factory_mock.return_value = ase_client

        resource_group_mock.return_value = rg_name

        host_env = HostingEnvironmentProfile(id='id1')
        host_env.name = ase_name
        host_env.resource_group = rg_name
        host_env.worker_pools = []
        ase_client.get.return_value = host_env
        ase_client.list.return_value = [host_env]

        update_appserviceenvironment(self.mock_cmd,
                                     ase_name,
                                     front_end_scale_factor=10)

        # Assert create_or_update is called with correct properties
        assert_host_env = HostingEnvironmentProfile(id='id1')
        assert_host_env.name = ase_name
        assert_host_env.resource_group = rg_name
        assert_host_env.worker_pools = []
        assert_host_env.internal_load_balancing_mode = None
        assert_host_env.front_end_scale_factor = 10
        ase_client.create_or_update.assert_called_once_with(
            name=ase_name,
            resource_group_name=rg_name,
            hosting_environment_envelope=assert_host_env)
    def test_app_service_environment_delete(self, ase_client_factory_mock,
                                            resource_group_mock):
        ase_name = 'mock_ase_name'
        rg_name = 'mock_rg_name'

        ase_client = mock.MagicMock()
        ase_client_factory_mock.return_value = ase_client

        resource_group_mock.return_value = rg_name

        host_env = HostingEnvironmentProfile(id='id1')
        host_env.name = ase_name
        host_env.resource_group = rg_name
        host_env.worker_pools = []
        ase_client.get.return_value = host_env
        ase_client.list.return_value = [host_env]

        delete_appserviceenvironment(self.mock_cmd, ase_name)

        # Assert delete is called with correct properties
        assert_host_env = HostingEnvironmentProfile(id='id1')
        assert_host_env.name = ase_name
        assert_host_env.resource_group = rg_name
        ase_client.delete.assert_called_once_with(name=ase_name,
                                                  resource_group_name=rg_name)