Skip to content

Commit bf8708d

Browse files
authored
Merge pull request #683 from UiPath/feature/add_auth_test
test: add auth config test for backwards compatibility
2 parents a80003f + 2a90b87 commit bf8708d

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

tests/cli/test_oidc_utils.py

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
"""
2+
Unit tests for OidcUtils.get_auth_config() method.
3+
4+
IMPORTANT: Backwards Compatibility Notice
5+
=========================================
6+
If any values in auth_config.json are changed, we MUST maintain backwards
7+
compatibility with release/2025.10 branches or later.
8+
"""
9+
10+
import json
11+
import os
12+
13+
14+
class TestOidcUtils:
15+
"""Test suite for OidcUtils class."""
16+
17+
def test_auth_config_backwards_compatibility_v2025_10(self):
18+
"""
19+
Test that auth_config.json maintains backwards compatibility with release/v2025.10.
20+
21+
This test validates that the authentication configuration values remain
22+
unchanged to ensure compatibility with release/v2025.10 and later branches.
23+
24+
CRITICAL: Any failure indicates a breaking change that requires coordination
25+
across all supported release branches.
26+
"""
27+
# Read the actual auth_config.json file
28+
config_path = os.path.join(
29+
os.path.dirname(__file__),
30+
"..",
31+
"..",
32+
"src",
33+
"uipath",
34+
"_cli",
35+
"_auth",
36+
"auth_config.json",
37+
)
38+
39+
with open(config_path, "r") as f:
40+
actual_config = json.load(f)
41+
42+
# Assert exact values for non-scope fields
43+
assert actual_config["client_id"] == "36dea5b8-e8bb-423d-8e7b-c808df8f1c00", (
44+
f"BACKWARDS COMPATIBILITY VIOLATION: client_id has changed! "
45+
f"Expected: 36dea5b8-e8bb-423d-8e7b-c808df8f1c00, Got: {actual_config['client_id']}"
46+
)
47+
48+
assert (
49+
actual_config["redirect_uri"]
50+
== "http://localhost:__PY_REPLACE_PORT__/oidc/login"
51+
), (
52+
f"BACKWARDS COMPATIBILITY VIOLATION: redirect_uri has changed! "
53+
f"Expected: http://localhost:__PY_REPLACE_PORT__/oidc/login, Got: {actual_config['redirect_uri']}"
54+
)
55+
56+
assert actual_config["port"] == 8104, (
57+
f"BACKWARDS COMPATIBILITY VIOLATION: port has changed! "
58+
f"Expected: 8104, Got: {actual_config['port']}"
59+
)
60+
61+
# For scopes, ensure actual scopes are a subset of the allowed scopes (no new scopes allowed)
62+
allowed_scopes = set(
63+
[
64+
"offline_access",
65+
"ProcessMining",
66+
"OrchestratorApiUserAccess",
67+
"StudioWebBackend",
68+
"IdentityServerApi",
69+
"ConnectionService",
70+
"DataService",
71+
"DocumentUnderstanding",
72+
"Du.Digitization.Api",
73+
"Du.Classification.Api",
74+
"Du.Extraction.Api",
75+
"Du.Validation.Api",
76+
"EnterpriseContextService",
77+
"Directory",
78+
"JamJamApi",
79+
"LLMGateway",
80+
"LLMOps",
81+
"OMS",
82+
"RCS.FolderAuthorization",
83+
"TM.Projects",
84+
"TM.TestCases",
85+
"TM.Requirements",
86+
"TM.TestSets",
87+
]
88+
)
89+
90+
actual_scopes = set(actual_config["scope"].split())
91+
92+
assert actual_scopes.issubset(allowed_scopes), (
93+
f"BACKWARDS COMPATIBILITY VIOLATION: New scopes detected that are not allowed on v2025.10! "
94+
f"New scopes: {actual_scopes - allowed_scopes}. "
95+
f"Only subsets of the following scopes are permitted: {sorted(allowed_scopes)}"
96+
)

0 commit comments

Comments
 (0)