-
Notifications
You must be signed in to change notification settings - Fork 207
Arlington automation #165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arlington automation #165
Changes from 1 commit
8e0b7dc
179a2ca
e62f34e
b254f74
7039052
3c397c3
34781cf
f29954b
c14ee36
c3cfbca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -102,7 +102,7 @@ def _test_username_password(self, | |||||
| username=username if ".b2clogin.com" not in authority else None, | ||||||
| ) | ||||||
|
|
||||||
| def _test_device_code( | ||||||
| def _test_device_flow( | ||||||
| self, client_id=None, authority=None, scope=None, **ignored): | ||||||
| assert client_id and authority and scope | ||||||
| self.app = msal.PublicClientApplication( | ||||||
|
|
@@ -270,7 +270,7 @@ def setUpClass(cls): | |||||
| cls.config = json.load(f) | ||||||
|
|
||||||
| def test_device_flow(self): | ||||||
| self._test_device_code(**self.config) | ||||||
| self._test_device_flow(**self.config) | ||||||
|
|
||||||
|
|
||||||
| def get_lab_app( | ||||||
|
|
@@ -327,7 +327,7 @@ def tearDownClass(cls): | |||||
| cls.session.close() | ||||||
|
|
||||||
| @classmethod | ||||||
| def get_lab_app_object(cls, **query): # https://msidlab.com/swagger/index.html | ||||||
| def get_lab_app_object(cls, **query): # https://msidlab.com/swagger/index.html | ||||||
| url = "https://msidlab.com/api/app" | ||||||
| resp = cls.session.get(url, params=query) | ||||||
| return resp.json()[0] | ||||||
|
|
@@ -349,10 +349,10 @@ def get_lab_user(cls, **query): # https://docs.msidlab.com/labapi/userapi.html | |||||
| _env = query.get("azureenvironment", "").lower() | ||||||
| authority_base = { | ||||||
| "azureusgovernment": "https://login.microsoftonline.us/" | ||||||
| }.get(_env, "https://login.microsoftonline.com/") | ||||||
| }.get(_env, "https://login.microsoftonline.com/") | ||||||
| scope = { | ||||||
| "azureusgovernment": ["https://graph.microsoft.us/.default"], | ||||||
| }.get(_env, ["https://graph.microsoft.com/.default"]) | ||||||
| }.get(_env, ["https://graph.microsoft.com/.default"]) | ||||||
| return { # Mapping lab API response to our simplified configuration format | ||||||
| "authority": authority_base + result["tenantID"], | ||||||
| "client_id": result["appId"], | ||||||
|
|
@@ -366,7 +366,7 @@ def _test_acquire_token_by_auth_code( | |||||
| **ignored): | ||||||
| assert client_id and authority and port and scope | ||||||
| (self.app, ac, redirect_uri) = _get_app_and_auth_code( | ||||||
| client_id, authority, port, scope) | ||||||
| client_id, authority=authority, port=port, scopes=scope) | ||||||
| result = self.app.acquire_token_by_authorization_code( | ||||||
| ac, scope, redirect_uri=redirect_uri) | ||||||
| logger.debug( | ||||||
|
|
@@ -516,17 +516,20 @@ def test_b2c_acquire_token_by_auth_code(self): | |||||
| # This won't work https://msidlab.com/api/user?usertype=b2c | ||||||
| password="***" # From https://aka.ms/GetLabUserSecret?Secret=msidlabb2c | ||||||
| """ | ||||||
| config = {"authority": self._build_b2c_authority("B2C_1_SignInPolicy"), | ||||||
| "client_id": "b876a048-55a5-4fc5-9403-f5d90cb1c852", | ||||||
| "scope": ["https://msidlabb2c.onmicrosoft.com/msaapp/user_impersonation"], "port": 3843} | ||||||
| self._test_acquire_token_by_auth_code(**config) | ||||||
| self._test_acquire_token_by_auth_code( | ||||||
| authority=self._build_b2c_authority("B2C_1_SignInPolicy"), | ||||||
| client_id="b876a048-55a5-4fc5-9403-f5d90cb1c852", port=3843, | ||||||
rayluo marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| scope=["https://msidlabb2c.onmicrosoft.com/msaapp/user_impersonation"] | ||||||
| ) | ||||||
|
|
||||||
| def test_b2c_acquire_token_by_ropc(self): | ||||||
| config = {"authority": self._build_b2c_authority("B2C_1_ROPC_Auth"), | ||||||
| "client_id": "e3b9ad76-9763-4827-b088-80c7a7888f79", | ||||||
| "username": "[email protected]", "password": self.get_lab_user_secret("msidlabb2c"), | ||||||
| "scope": ["https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read"]} | ||||||
| self._test_username_password(**config) | ||||||
| self._test_username_password( | ||||||
| authority=self._build_b2c_authority("B2C_1_ROPC_Auth"), | ||||||
| client_id="e3b9ad76-9763-4827-b088-80c7a7888f79", | ||||||
| username="[email protected]", | ||||||
| password=self.get_lab_user_secret("msidlabb2c"), | ||||||
| scope=["https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read"] | ||||||
|
||||||
| scope=["https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read"] | |
| scope=["https://msidlabb2c.onmicrosoft.com/msidlabb2capi/read"], |
Reasoning: PEP 8 on Trailing commas
PS: It is not necessarily that I paid attention to this kind of details. It is the github PR review UI highlighting the different lines in red-and-green in order to grab reviewer's attention. So, a universal hint for a PR author is to conduct a self-review on github PR UI to see whether each of those red-and-green snippets is intended and/or necessary.
Uh oh!
There was an error while loading. Please reload this page.