@@ -39,7 +39,7 @@ def _build_test_jwt(claims):
3939 return '.' .join (base64 .urlsafe_b64encode (p .encode ('utf-8' )).decode ('utf-8' ).replace ('=' , '' ) for p in parts )
4040
4141
42- def _now_timestamp_mock ():
42+ def now_timestamp_mock ():
4343 # 2021-09-06 08:55:23
4444 return 1630918523
4545
@@ -1013,7 +1013,7 @@ def test_get_login_credentials_mi_user_assigned_resource_id(self):
10131013 assert cred ._credential .object_id is None
10141014 assert cred ._credential .resource_id == self .test_mi_resource_id
10151015
1016- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1016+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
10171017 @mock .patch ('azure.cli.core.auth.identity.Identity.get_user_credential' )
10181018 def test_get_raw_token (self , get_user_credential_mock ):
10191019 credential_mock_temp = MsalCredentialStub ()
@@ -1061,7 +1061,7 @@ def test_get_raw_token(self, get_user_credential_mock):
10611061 self .assertIsNone (sub )
10621062 self .assertEqual (tenant , self .tenant_id )
10631063
1064- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1064+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
10651065 @mock .patch ('azure.cli.core.auth.identity.Identity.get_service_principal_credential' )
10661066 def test_get_raw_token_for_sp (self , get_service_principal_credential_mock ):
10671067 credential_mock_temp = MsalCredentialStub ()
@@ -1102,7 +1102,7 @@ def test_get_raw_token_for_sp(self, get_service_principal_credential_mock):
11021102 self .assertIsNone (sub )
11031103 self .assertEqual (tenant , self .tenant_id )
11041104
1105- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1105+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
11061106 @mock .patch ('azure.cli.core.auth.msal_credentials.ManagedIdentityCredential' , ManagedIdentityCredentialStub )
11071107 def test_get_raw_token_mi_system_assigned (self ):
11081108 profile = Profile (cli_ctx = DummyCli (), storage = {'subscriptions' : None })
@@ -1136,7 +1136,7 @@ def test_get_raw_token_mi_system_assigned(self):
11361136 with self .assertRaisesRegex (CLIError , "Tenant shouldn't be specified" ):
11371137 cred , subscription_id , _ = profile .get_raw_token (resource = 'http://test_resource' , tenant = self .tenant_id )
11381138
1139- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1139+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
11401140 @mock .patch ('azure.cli.core.auth.msal_credentials.ManagedIdentityCredential' , ManagedIdentityCredentialStub )
11411141 def test_get_raw_token_mi_user_assigned_client_id (self ):
11421142 profile = Profile (cli_ctx = DummyCli (), storage = {'subscriptions' : None })
@@ -1167,7 +1167,7 @@ def test_get_raw_token_mi_user_assigned_client_id(self):
11671167 self .assertEqual (subscription_id , self .test_mi_subscription_id )
11681168 self .assertEqual (tenant_id , self .test_mi_tenant )
11691169
1170- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1170+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
11711171 @mock .patch ('azure.cli.core.auth.msal_credentials.ManagedIdentityCredential' , ManagedIdentityCredentialStub )
11721172 def test_get_raw_token_mi_user_assigned_object_id (self ):
11731173 profile = Profile (cli_ctx = DummyCli (), storage = {'subscriptions' : None })
@@ -1198,7 +1198,7 @@ def test_get_raw_token_mi_user_assigned_object_id(self):
11981198 self .assertEqual (subscription_id , self .test_mi_subscription_id )
11991199 self .assertEqual (tenant_id , self .test_mi_tenant )
12001200
1201- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1201+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
12021202 @mock .patch ('azure.cli.core.auth.msal_credentials.ManagedIdentityCredential' , ManagedIdentityCredentialStub )
12031203 def test_get_raw_token_mi_user_assigned_resource_id (self ):
12041204 profile = Profile (cli_ctx = DummyCli (), storage = {'subscriptions' : None })
@@ -1229,7 +1229,7 @@ def test_get_raw_token_mi_user_assigned_resource_id(self):
12291229 self .assertEqual (subscription_id , self .test_mi_subscription_id )
12301230 self .assertEqual (tenant_id , self .test_mi_tenant )
12311231
1232- @mock .patch ('azure.cli.core.auth.util._now_timestamp ' , new = _now_timestamp_mock )
1232+ @mock .patch ('azure.cli.core.auth.util.now_timestamp ' , new = now_timestamp_mock )
12331233 @mock .patch ('azure.cli.core._profile.in_cloud_console' , autospec = True )
12341234 @mock .patch ('azure.cli.core.auth.msal_credentials.CloudShellCredential' , autospec = True )
12351235 def test_get_raw_token_in_cloud_shell (self , cloud_shell_credential_mock , mock_in_cloud_console ):
0 commit comments