File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
src/azure-cli-core/azure/cli/core/tests Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 44# --------------------------------------------------------------------------------------------
55
66import unittest
7+ from unittest import mock
78
89
910class TestCoreTelemetry (unittest .TestCase ):
@@ -57,3 +58,24 @@ def test_cloud_forbid_telemetry(self):
5758 # mock to add current cloud name in CLOUDS_FORBIDDING_TELEMETRY
5859 with mock .patch ('azure.cli.core.cloud.CLOUDS_FORBIDDING_TELEMETRY' , [az_cli .cloud .name ]):
5960 self .assertFalse (telemetry .is_telemetry_enabled ())
61+
62+ @mock .patch ('azure.cli.core.util.get_az_version_string' )
63+ def test_show_version_sets_telemetry_params (self , mock_get_version ):
64+ """Test show_version telemetry state is same regardless of available updates."""
65+ from azure .cli .core .mock import DummyCli
66+ from azure .cli .core import telemetry
67+ from knack .completion import ARGCOMPLETE_ENV_NAME
68+
69+ mock_get_version .return_value = ("azure-cli 2.80.0" , ["core" , "extension1" ])
70+
71+ telemetry .start ()
72+
73+ cli = DummyCli ()
74+ telemetry .set_application (cli , ARGCOMPLETE_ENV_NAME )
75+
76+ cli .show_version ()
77+
78+ session = telemetry ._session
79+ self .assertEqual (session .command , "" )
80+ self .assertEqual (session .parameters , ["--version" ])
81+ self .assertIsNone (session .raw_command )
You can’t perform that action at this time.
0 commit comments