|
15 | 15 | 4. Run this test by `python broker-test.py` and make sure all the tests passed. |
16 | 16 |
|
17 | 17 | """ |
18 | | -import unittest |
19 | 18 | import msal |
20 | 19 | import getpass |
21 | 20 | import os |
| 21 | +import warnings |
22 | 22 | try: |
23 | 23 | from dotenv import load_dotenv # Use this only in local dev machine |
24 | 24 | load_dotenv() # take environment variables from .env. |
@@ -68,20 +68,17 @@ def interactive_and_silent(scopes, auth_scheme, data, expected_token_type): |
68 | 68 | ) |
69 | 69 | _assert(result, expected_token_type) |
70 | 70 |
|
71 | | -@unittest.skip("ROPC API has been deprecated and thus these tests are no longer needed") |
72 | 71 | def test_broker_username_password(scopes, expected_token_type): |
73 | 72 | print("Testing broker username password flows by using accounts in local .env") |
74 | 73 | username = os.getenv("BROKER_TEST_ACCOUNT") or input("Input test account for broker test: ") |
75 | 74 | password = os.getenv("BROKER_TEST_ACCOUNT_PASSWORD") or getpass.getpass("Input test account's password: ") |
76 | 75 | assert username and password, "You need to provide a test account and its password" |
77 | 76 | result = pca.acquire_token_by_username_password(username, password, scopes) |
78 | 77 | _assert(result, expected_token_type) |
79 | | - assert result.get("token_source") == "broker" |
80 | 78 | print("Username password test succeeds.") |
81 | 79 |
|
82 | 80 | def _assert(result, expected_token_type): |
83 | 81 | assert result.get("access_token"), f"We should obtain a token. Got {result} instead." |
84 | | - assert result.get("token_source") == "broker", "Token should be obtained via broker" |
85 | 82 | assert result.get("token_type").lower() == expected_token_type.lower(), f"{expected_token_type} not found" |
86 | 83 |
|
87 | 84 | for i in range(2): # Mimic Azure CLI's issue report |
|
0 commit comments