Skip to content

Commit c76fa0b

Browse files
committed
fix: linter fixes
1 parent 1d3987d commit c76fa0b

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

openfga_sdk/credentials.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
1010
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1111
"""
12-
import re
12+
1313
from urllib.parse import urlparse, urlunparse
1414

1515
from openfga_sdk.exceptions import ApiValueError
@@ -161,7 +161,7 @@ def configuration(self, value):
161161
self._configuration = value
162162

163163
def _parse_issuer(self, issuer: str):
164-
default_endpoint_path = '/oauth/token'
164+
default_endpoint_path = "/oauth/token"
165165

166166
parsed_url = urlparse(issuer.strip())
167167

@@ -176,7 +176,9 @@ def _parse_issuer(self, issuer: str):
176176
if parsed_url.scheme == "":
177177
parsed_url = urlparse(f"https://{issuer}")
178178
elif parsed_url.scheme not in ("http", "https"):
179-
raise ApiValueError(f"Invalid issuer scheme {parsed_url.scheme} must be HTTP or HTTPS")
179+
raise ApiValueError(
180+
f"Invalid issuer scheme {parsed_url.scheme} must be HTTP or HTTPS"
181+
)
180182

181183
if parsed_url.path in ("", "/"):
182184
parsed_url = parsed_url._replace(path=default_endpoint_path)
@@ -216,5 +218,4 @@ def validate_credentials_config(self):
216218
)
217219
# validate token issuer
218220

219-
parsed_issuer_url = self._parse_issuer(self.configuration.api_issuer)
220-
221+
self._parse_issuer(self.configuration.api_issuer)

test/credentials_test.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1111
"""
1212

13+
import unittest
1314
from unittest import IsolatedAsyncioTestCase
1415

1516
import openfga_sdk
1617
from openfga_sdk import ApiValueError
1718
from openfga_sdk.credentials import CredentialConfiguration, Credentials
18-
import unittest
1919

2020

2121
class TestCredentials(IsolatedAsyncioTestCase):
@@ -176,12 +176,13 @@ def test_configuration_client_credentials_missing_api_audience(self):
176176
credential.validate_credentials_config()
177177

178178

179-
180179
class TestCredentialsIssuer(unittest.TestCase):
181180
def setUp(self):
182181
# Setup a basic configuration that can be modified per test case
183182
self.configuration = CredentialConfiguration(api_issuer="https://example.com")
184-
self.credentials = Credentials(method="client_credentials", configuration=self.configuration)
183+
self.credentials = Credentials(
184+
method="client_credentials", configuration=self.configuration
185+
)
185186

186187
def test_valid_issuer_https(self):
187188
# Test a valid HTTPS URL
@@ -232,5 +233,6 @@ def test_invalid_issuer_bad_hostname(self):
232233
with self.assertRaises(ApiValueError):
233234
self.credentials._parse_issuer(self.configuration.api_issuer)
234235

236+
235237
if __name__ == "__main__":
236238
unittest.main()

0 commit comments

Comments
 (0)