Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 20, 2023
1 parent f8aeaea commit e8e80cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions oauth2_provider/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,28 @@ def __call__(self, value):
if query and not self.allow_query:
raise ValidationError(
"%(name)s URI validation error. %(cause)s: %(value)s",
params={ "name": self.name, "value": value, "cause": 'query string not allowed'}
params={"name": self.name, "value": value, "cause": "query string not allowed"},
)
if fragment and not self.allow_fragments:
raise ValidationError(
"%(name)s URI validation error. %(cause)s: %(value)s",
params={ "name": self.name, "value": value, "cause": 'fragment not allowed'}
params={"name": self.name, "value": value, "cause": "fragment not allowed"},
)
if path and not self.allow_path:
raise ValidationError(
"%(name)s URI validation error. %(cause)s: %(value)s",
params={ "name": self.name, "value": value, "cause": 'path not allowed'}
params={"name": self.name, "value": value, "cause": "path not allowed"},
)

try:
super().__call__(value)
except ValidationError as e:
raise ValidationError(

Check warning on line 89 in oauth2_provider/validators.py

View check run for this annotation

Codecov / codecov/patch

oauth2_provider/validators.py#L88-L89

Added lines #L88 - L89 were not covered by tests
"%(name)s URI validation error. %(cause)s: %(value)s",
params={ "name": self.name, "value": value, "cause": e}
params={"name": self.name, "value": value, "cause": e},
)




##
# WildcardSet is a special set that contains everything.
# This is required in order to move validation of the scheme from
Expand Down
2 changes: 1 addition & 1 deletion tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_invalid_schemes(self):
"http:/example.com",
"HTTP://localhost",
"HTTP://example.com",
"HTTP://-example.com-", # triggers an exception in the upstream validators
"HTTP://-example.com-", # triggers an exception in the upstream validators
"HTTP://example.com/path",
"HTTP://example.com/path?query=string",
"HTTP://example.com/path?query=string#fragmemt",
Expand Down

0 comments on commit e8e80cb

Please sign in to comment.