Skip to content

Commit

Permalink
fix precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
jpadilla committed Oct 13, 2024
1 parent 3065fdf commit bc97f6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 24.8.0
rev: 24.10.0
hooks:
- id: black
args: ["--target-version=py38"]

- repo: https://github.com/asottile/blacken-docs
rev: 1.17.0
rev: 1.19.0
hooks:
- id: blacken-docs
args: ["--target-version=py38"]
Expand All @@ -17,14 +17,14 @@ repos:
- id: isort

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: debug-statements

- repo: https://github.com/mgedmin/check-manifest
rev: "0.49"
rev: "0.50"
hooks:
- id: check-manifest
args: [--no-build-isolation]
Expand All @@ -40,13 +40,14 @@ repos:
hooks:
- id: validate-pyproject

- repo: https://github.com/kieran-ryan/pyprojectsort
rev: "v0.3.0"
hooks:
- id: pyprojectsort
# conflict with the backend dependencies: tomli-w==1.1.0 is incompatible with tomli-w==1.0.0.
# - repo: https://github.com/kieran-ryan/pyprojectsort
# rev: "v0.3.0"
# hooks:
# - id: pyprojectsort

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: "0.29.3"
rev: "0.29.4"
hooks:
- id: check-github-workflows
- id: check-readthedocs
Expand Down
9 changes: 3 additions & 6 deletions tests/test_api_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,18 +832,16 @@ def test_encode_decode_sub_claim(self, jwt):
assert decoded["sub"] == "user123"

def test_decode_without_and_not_required_sub_claim(self, jwt):
payload = {}
secret = "your-256-bit-secret"
token = jwt.encode(payload, secret, algorithm="HS256")
token = jwt.encode({}, secret, algorithm="HS256")

decoded = jwt.decode(token, secret, algorithms=["HS256"])

assert "sub" not in decoded

def test_decode_missing_sub_but_required_claim(self, jwt):
payload = {}
secret = "your-256-bit-secret"
token = jwt.encode(payload, secret, algorithm="HS256")
token = jwt.encode({}, secret, algorithm="HS256")

with pytest.raises(MissingRequiredClaimError):
jwt.decode(
Expand Down Expand Up @@ -918,9 +916,8 @@ def test_decode_missing_jti_when_required_claim(self, jwt):
assert "jti" in str(exc_info.value)

def test_decode_missing_jti_claim(self, jwt):
payload = {}
secret = "your-256-bit-secret"
token = jwt.encode(payload, secret, algorithm="HS256")
token = jwt.encode({}, secret, algorithm="HS256")

decoded = jwt.decode(token, secret, algorithms=["HS256"])

Expand Down

0 comments on commit bc97f6a

Please sign in to comment.