@@ -31,7 +31,7 @@ class TestApiKeyAuth:
3131 def test_api_key_auth_basic (self ):
3232 """Test creating basic API key auth config."""
3333 config = api_key_auth ("test-provider" )
34-
34+
3535 assert isinstance (config , ApiKeyAuthConfig )
3636 assert config .provider_name == "test-provider"
3737 assert config .auth_type == "api_key"
@@ -41,7 +41,7 @@ def test_api_key_auth_basic(self):
4141 def test_api_key_auth_with_region (self ):
4242 """Test creating API key auth config with custom region."""
4343 config = api_key_auth ("test-provider" , region = "us-east-1" )
44-
44+
4545 assert config .provider_name == "test-provider"
4646 assert config .region == "us-east-1"
4747 assert config .auth_type == "api_key"
@@ -63,11 +63,9 @@ class TestOAuth2Auth:
6363 def test_oauth2_auth_basic (self ):
6464 """Test creating basic OAuth2 auth config."""
6565 config = oauth2_auth (
66- provider_name = "github" ,
67- scopes = ["repo" , "user" ],
68- auth_flow = "M2M"
66+ provider_name = "github" , scopes = ["repo" , "user" ], auth_flow = "M2M"
6967 )
70-
68+
7169 assert isinstance (config , OAuth2AuthConfig )
7270 assert config .provider_name == "github"
7371 assert config .scopes == ["repo" , "user" ]
@@ -78,9 +76,10 @@ def test_oauth2_auth_basic(self):
7876
7977 def test_oauth2_auth_with_all_params (self ):
8078 """Test creating OAuth2 auth config with all parameters."""
79+
8180 def on_auth_url_callback (url : str ):
8281 pass
83-
82+
8483 config = oauth2_auth (
8584 provider_name = "github" ,
8685 scopes = ["repo" , "user" ],
@@ -89,9 +88,9 @@ def on_auth_url_callback(url: str):
8988 force_authentication = True ,
9089 response_for_auth_required = "Please authorize" ,
9190 on_auth_url = on_auth_url_callback ,
92- region = "us-west-2"
91+ region = "us-west-2" ,
9392 )
94-
93+
9594 assert config .provider_name == "github"
9695 assert config .scopes == ["repo" , "user" ]
9796 assert config .auth_flow == "USER_FEDERATION"
@@ -104,39 +103,33 @@ def on_auth_url_callback(url: str):
104103 def test_oauth2_auth_empty_scopes (self ):
105104 """Test that empty scopes raises ValueError."""
106105 with pytest .raises (ValueError , match = "scopes cannot be an empty list" ):
107- oauth2_auth (
108- provider_name = "github" ,
109- scopes = [],
110- auth_flow = "M2M"
111- )
106+ oauth2_auth (provider_name = "github" , scopes = [], auth_flow = "M2M" )
112107
113108 def test_oauth2_auth_empty_scope_value (self ):
114109 """Test that empty scope value raises ValueError."""
115110 with pytest .raises (ValueError , match = "scope values cannot be empty" ):
116- oauth2_auth (
117- provider_name = "github" ,
118- scopes = ["repo" , "" ],
119- auth_flow = "M2M"
120- )
111+ oauth2_auth (provider_name = "github" , scopes = ["repo" , "" ], auth_flow = "M2M" )
121112
122113 def test_oauth2_auth_duplicate_scopes_removed (self ):
123114 """Test that duplicate scopes are removed."""
124115 config = oauth2_auth (
125116 provider_name = "github" ,
126117 scopes = ["repo" , "user" , "repo" , "user" ],
127- auth_flow = "M2M"
118+ auth_flow = "M2M" ,
128119 )
129-
120+
130121 assert config .scopes == ["repo" , "user" ]
131122
132123 def test_oauth2_auth_invalid_callback_url (self ):
133124 """Test that invalid callback URL raises ValueError."""
134- with pytest .raises (ValueError , match = "callback_url must be a valid HTTP/HTTPS URL" ):
125+ with pytest .raises (
126+ ValueError , match = "callback_url must be a valid HTTP/HTTPS URL"
127+ ):
135128 oauth2_auth (
136129 provider_name = "github" ,
137130 scopes = ["repo" ],
138131 auth_flow = "M2M" ,
139- callback_url = "invalid-url"
132+ callback_url = "invalid-url" ,
140133 )
141134
142135 def test_oauth2_auth_valid_https_callback_url (self ):
@@ -145,9 +138,9 @@ def test_oauth2_auth_valid_https_callback_url(self):
145138 provider_name = "github" ,
146139 scopes = ["repo" ],
147140 auth_flow = "M2M" ,
148- callback_url = "https://example.com/callback"
141+ callback_url = "https://example.com/callback" ,
149142 )
150-
143+
151144 assert config .callback_url == "https://example.com/callback"
152145
153146 def test_oauth2_auth_valid_http_callback_url (self ):
@@ -156,9 +149,9 @@ def test_oauth2_auth_valid_http_callback_url(self):
156149 provider_name = "github" ,
157150 scopes = ["repo" ],
158151 auth_flow = "M2M" ,
159- callback_url = "http://localhost:8080/callback"
152+ callback_url = "http://localhost:8080/callback" ,
160153 )
161-
154+
162155 assert config .callback_url == "http://localhost:8080/callback"
163156
164157
@@ -168,7 +161,7 @@ class TestWorkloadAuth:
168161 def test_workload_auth_basic (self ):
169162 """Test creating basic workload auth config."""
170163 config = workload_auth ("test-provider" )
171-
164+
172165 assert isinstance (config , WorkloadAuthConfig )
173166 assert config .provider_name == "test-provider"
174167 assert config .auth_type == "workload"
@@ -178,7 +171,7 @@ def test_workload_auth_basic(self):
178171 def test_workload_auth_with_region (self ):
179172 """Test creating workload auth config with custom region."""
180173 config = workload_auth ("test-provider" , region = "eu-west-1" )
181-
174+
182175 assert config .provider_name == "test-provider"
183176 assert config .region == "eu-west-1"
184177 assert config .auth_type == "workload"
@@ -187,4 +180,3 @@ def test_workload_auth_empty_provider_name(self):
187180 """Test that empty provider_name raises ValueError."""
188181 with pytest .raises (ValueError , match = "provider_name cannot be empty" ):
189182 workload_auth ("" )
190-
0 commit comments