Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import importlib.util
import sys
from pathlib import Path
from types import SimpleNamespace
from types import ModuleType, SimpleNamespace
from unittest.mock import MagicMock

import pytest
Expand Down Expand Up @@ -41,7 +41,7 @@


@pytest.fixture()
def provisioner_module():
def provisioner_module() -> ModuleType:
"""Load docker/provisioner/app.py as an importable test module.

Shared by test_provisioner_kubeconfig and test_provisioner_pvc_volumes so
Expand Down
8 changes: 8 additions & 0 deletions backend/tests/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ def test_decode_token_invalid():
assert isinstance(decode_token("completely-wrong"), TokenError)


def test_decode_token_malformed_jwt():
"""JWT with wrong number of parts (not 3) returns TokenError."""
from app.gateway.auth.errors import TokenError

assert isinstance(decode_token("header.payload"), TokenError)
assert isinstance(decode_token("header.payload.signature.extra"), TokenError)


def test_create_token_custom_expiry():
"""Custom expiry is respected."""
user_id = str(uuid4())
Expand Down