Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def output(message):

if os.path.isfile(installation_path):
if not release_tag:
output(f"Bicep CLI is already installed at '{installation_path}'. Skipping installation as no specific version was requested.") # pylint: disable=line-too-long
if get_check_version_config(cli_ctx):
output(f"Bicep CLI is already installed at '{installation_path}'. Skipping installation as no specific version was requested.") # pylint: disable=line-too-long
return

installed_version = _get_bicep_installed_version(installation_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_get_data_boundary_scope(self):
**self.kwargs)

self.cmd('az data-boundary show --scope {scope} --default default', checks=[
self.check('properties.dataBoundary', 'EU'),
self.check_pattern('properties.dataBoundary', '^(EU|Global)$'),
self.check('properties.provisioningState', 'Succeeded')
])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,43 @@ def test_ensure_bicep_installation_skip_download_if_installed_version_matches_re

dirname_mock.assert_not_called()


@mock.patch("azure.cli.command_modules.resource._bicep.get_check_version_config")
@mock.patch("azure.cli.command_modules.resource._bicep._use_binary_from_path")
@mock.patch("azure.cli.command_modules.resource._bicep._get_bicep_installation_path")
@mock.patch("os.path.isfile")
@mock.patch("builtins.print")
def test_ensure_bicep_installation_no_message_if_check_version_is_disabled(
self, print_mock, isfile_stub, get_bicep_installation_path_mock, use_binary_from_path_mock, get_check_version_config_mock
):
isfile_stub.return_value = True
get_bicep_installation_path_mock.return_value = "/tmp/bicep"
use_binary_from_path_mock.return_value = False
get_check_version_config_mock.return_value = False

ensure_bicep_installation(self.cli_ctx)

print_mock.assert_not_called()

@mock.patch("azure.cli.command_modules.resource._bicep.get_check_version_config")
@mock.patch("azure.cli.command_modules.resource._bicep._use_binary_from_path")
@mock.patch("azure.cli.command_modules.resource._bicep._get_bicep_installation_path")
@mock.patch("os.path.isfile")
@mock.patch("builtins.print")
def test_ensure_bicep_installation_message_if_check_version_is_enabled(
self, print_mock, isfile_stub, get_bicep_installation_path_mock, use_binary_from_path_mock, get_check_version_config_mock
):
isfile_stub.return_value = True
get_bicep_installation_path_mock.return_value = "/tmp/bicep"
use_binary_from_path_mock.return_value = False
get_check_version_config_mock.return_value = True

ensure_bicep_installation(self.cli_ctx)

print_mock.assert_called_once_with(
"Bicep CLI is already installed at '/tmp/bicep'. Skipping installation as no specific version was requested."
)


@mock.patch("azure.cli.command_modules.resource._bicep.get_use_binary_from_path_config")
@mock.patch("azure.cli.command_modules.resource._bicep._get_bicep_installation_path")
@mock.patch("shutil.which")
Expand Down