Skip to content

Commit

Permalink
Fix validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Jan 26, 2024
1 parent 3bb1c2e commit c7fc637
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion oauthenticator/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def _allowed_scopes_validation(self, proposal):
# allowed scopes must be a subset of requested scopes
if set(proposal.value) - set(self.scope):
raise ValueError(
f"Allowed Scopes must be a subset of Requested Scopes. {self.scope} is requested but {proposal.value} is allowed"
f"Allowed scopes must be a subset of requested scopes. {self.scope} is requested but {proposal.value} is allowed"
)
return proposal.value

Expand Down
6 changes: 3 additions & 3 deletions oauthenticator/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,15 @@ async def test_allowed_scopes(
assert allowed == await authenticator.check_allowed(auth_model["name"], auth_model)


async def test_required_scopes_validation_scope_subset(get_authenticator):
async def test_allowed_scopes_validation_scope_subset(get_authenticator):
c = Config()
# Test that if we require more scopes than we request, validation fails
c.GenericOAuthenticator.required_scopes = ["a", "b"]
c.GenericOAuthenticator.allowed_scopes = ["a", "b"]
c.GenericOAuthenticator.scope = ["a"]
with raises(
ValueError,
match=re.escape(
"Required Scopes must be a subset of Requested Scopes. ['a'] is requested but ['a', 'b'] is required"
"Allowed scopes must be a subset of requested scopes. ['a'] is requested but ['a', 'b'] is allowed"
),
):
get_authenticator(config=c)
Expand Down

0 comments on commit c7fc637

Please sign in to comment.