3
3
import logging
4
4
import sys
5
5
6
- # from tests.test_e2e import LabBasedTestCase
7
-
8
6
if not sys .platform .startswith ("win" ):
9
7
raise unittest .SkipTest ("Currently, our broker supports Windows" )
10
8
14
12
_AZURE_CLI ,
15
13
authority = "https://login.microsoftonline.com/organizations" ,
16
14
enable_broker_on_mac = True ,
17
- enable_broker_on_windows = True )
18
-
19
-
20
- # class ForceRefreshTestCase(LabBasedTestCase):
21
- # def test_silent_with_force_refresh(self):
22
- # # acquire token using username and password
23
- # print("Testing silent flow with force_refresh=True")
24
- # config = self.get_lab_user(usertype="cloud")
25
- # config["password"] = self.get_lab_user_secret(config["lab_name"])
26
- # result = pca.acquire_token_by_username_password(username=config["lab_name"], password=config["password"], scopes=config["scope"])
27
- # # assert username and password, "You need to provide a test account and its password"
28
-
29
- # ropcToken = result.get("access_token")
30
- # accounts = pca.get_accounts()
31
- # account = accounts[0]
32
- # assert account, "The logged in account should have been established by interactive flow"
33
-
34
- # result = pca.acquire_token_silent(
35
- # config["scope"],
36
- # account=account,
37
- # force_refresh=False,
38
- # auth_scheme=None, data=None)
39
-
40
- # assert result.get("access_token") == ropcToken, "Token should not be refreshed"
41
-
15
+ enable_broker_on_windows = True )
42
16
43
17
class ForceRefreshTestCase (unittest .TestCase ):
44
18
def test_silent_with_force_refresh (self ):
45
- # acquire token using username and password
46
19
print ("Testing silent flow with force_refresh=True" )
47
20
result = pca .acquire_token_interactive (scopes = [SCOPE_ARM ], prompt = "select_account" , parent_window_handle = pca .CONSOLE_WINDOW_HANDLE , enable_msa_passthrough = True )
48
21
accounts = pca .get_accounts ()
@@ -56,7 +29,7 @@ def test_silent_with_force_refresh(self):
56
29
account = account ,
57
30
force_refresh = False )
58
31
59
- # This token should be recieved from cache
32
+ # This token should have been recieved from cache
60
33
assert result .get ("access_token" ) == oldToken , "Token should not be refreshed"
61
34
62
35
@@ -65,5 +38,5 @@ def test_silent_with_force_refresh(self):
65
38
account = account ,
66
39
force_refresh = True )
67
40
68
- # Token will be different proving it is not from cache and was renewed
41
+ # Token will be different proving it is not token from cache and was renewed
69
42
assert result .get ("access_token" ) != oldToken , "Token should be refreshed"
0 commit comments