@@ -331,7 +331,10 @@ class TestApplicationForRefreshInBehaviors(unittest.TestCase):
331
331
account = {"home_account_id" : "{}.{}" .format (uid , utid )}
332
332
rt = "this is a rt"
333
333
client_id = "my_app"
334
- app = ClientApplication (client_id , authority = authority_url )
334
+
335
+ @classmethod
336
+ def setUpClass (cls ): # Initialization at runtime, not interpret-time
337
+ cls .app = ClientApplication (cls .client_id , authority = cls .authority_url )
335
338
336
339
def setUp (self ):
337
340
self .app .token_cache = self .cache = msal .SerializableTokenCache ()
@@ -485,8 +488,10 @@ def mock_post(url, headers=None, *args, **kwargs):
485
488
486
489
487
490
class TestTelemetryOnClientApplication (unittest .TestCase ):
488
- app = ClientApplication (
489
- "client_id" , authority = "https://login.microsoftonline.com/common" )
491
+ @classmethod
492
+ def setUpClass (cls ): # Initialization at runtime, not interpret-time
493
+ cls .app = ClientApplication (
494
+ "client_id" , authority = "https://login.microsoftonline.com/common" )
490
495
491
496
def test_acquire_token_by_auth_code_flow (self ):
492
497
at = "this is an access token"
@@ -509,8 +514,10 @@ def mock_post(url, headers=None, *args, **kwargs):
509
514
510
515
511
516
class TestTelemetryOnPublicClientApplication (unittest .TestCase ):
512
- app = PublicClientApplication (
513
- "client_id" , authority = "https://login.microsoftonline.com/common" )
517
+ @classmethod
518
+ def setUpClass (cls ): # Initialization at runtime, not interpret-time
519
+ cls .app = PublicClientApplication (
520
+ "client_id" , authority = "https://login.microsoftonline.com/common" )
514
521
515
522
# For now, acquire_token_interactive() is verified by code review.
516
523
@@ -534,9 +541,11 @@ def mock_post(url, headers=None, *args, **kwargs):
534
541
535
542
536
543
class TestTelemetryOnConfidentialClientApplication (unittest .TestCase ):
537
- app = ConfidentialClientApplication (
538
- "client_id" , client_credential = "secret" ,
539
- authority = "https://login.microsoftonline.com/common" )
544
+ @classmethod
545
+ def setUpClass (cls ): # Initialization at runtime, not interpret-time
546
+ cls .app = ConfidentialClientApplication (
547
+ "client_id" , client_credential = "secret" ,
548
+ authority = "https://login.microsoftonline.com/common" )
540
549
541
550
def test_acquire_token_for_client (self ):
542
551
at = "this is an access token"
0 commit comments