Skip to content
Merged
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
6 changes: 6 additions & 0 deletions tests/session/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class TestRequireSessionAlias:
def test_require_session_is_get_session_alias(self) -> None:
assert require_session is get_session

@pytest.mark.filterwarnings(
"ignore:SessionMiddleware is deprecated:DeprecationWarning"
)
def test_require_session_via_http_endpoint(self) -> None:
"""require_session used as a route dependency must return 401 without session."""
config = SessionConfig(secret_key="a" * 32)
Expand All @@ -86,6 +89,9 @@ async def protected(session=Depends(require_session)):
r = dep_client.get("/protected")
assert r.status_code == 401

@pytest.mark.filterwarnings(
"ignore:SessionMiddleware is deprecated:DeprecationWarning"
)
@pytest.mark.asyncio
async def test_require_session_with_valid_session(self) -> None:
"""require_session passes when a valid session is present."""
Expand Down
4 changes: 4 additions & 0 deletions tests/session/test_get_session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from fastapi_cachex.session.proxy import SessionManagerProxy


@pytest.mark.filterwarnings("ignore:SessionMiddleware is deprecated:DeprecationWarning")
def test_get_session_manager_dependency(
manager: SessionManager, config: SessionConfig
) -> None:
Expand All @@ -39,6 +40,7 @@ async def test_endpoint(
assert response.json()["has_manager"] is True


@pytest.mark.filterwarnings("ignore:SessionMiddleware is deprecated:DeprecationWarning")
@pytest.mark.asyncio
async def test_get_session_manager_allows_create_session(
manager: SessionManager, config: SessionConfig
Expand Down Expand Up @@ -89,6 +91,7 @@ async def test_endpoint(
assert "SessionManager not initialized" in response.json()["detail"]


@pytest.mark.filterwarnings("ignore:SessionMiddleware is deprecated:DeprecationWarning")
@pytest.mark.asyncio
async def test_get_session_manager_full_workflow(
manager: SessionManager, config: SessionConfig
Expand Down Expand Up @@ -130,6 +133,7 @@ async def logout(
assert logout_response.json()["message"] == "logged out"


@pytest.mark.filterwarnings("ignore:SessionMiddleware is deprecated:DeprecationWarning")
def test_session_manager_type_annotation(
manager: SessionManager, config: SessionConfig
) -> None:
Expand Down
Loading
Loading