Skip to content

Commit a7c1e1a

Browse files
committed
chore: formatting
1 parent 2b93546 commit a7c1e1a

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

test/components/renku_data_services/base_models/test_session_metrics.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
"""
88

99
import pytest
10+
1011
from renku_data_services.metrics.core import StagingMetricsService
1112
from renku_data_services.notebooks.core_sessions import _make_patch_spec_list
1213

1314

1415
@pytest.mark.asyncio
1516
async def test_session_metrics_metadata_structure():
1617
"""Test that session metrics store metadata with correct structure."""
18+
1719
# Create mock metrics repo
1820
async def mock_store_event(*args, **kwargs):
1921
pass
@@ -24,10 +26,14 @@ async def mock_store_event(*args, **kwargs):
2426
metrics = StagingMetricsService(enabled=True, metrics_repo=mock_metrics_repo)
2527

2628
# Create mock user with required attributes
27-
mock_user = type("APIUser", (), {
28-
"id": "test-user-123",
29-
"is_authenticated": True,
30-
})()
29+
mock_user = type(
30+
"APIUser",
31+
(),
32+
{
33+
"id": "test-user-123",
34+
"is_authenticated": True,
35+
},
36+
)()
3137

3238
# Test session_started metadata with all resource fields
3339
await metrics.session_started(
@@ -122,11 +128,12 @@ class MyResource:
122128
@pytest.mark.asyncio
123129
async def test_session_metrics_metadata_fields_match_implementation():
124130
"""Verify that test metadata matches what's actually sent in the implementation.
125-
131+
126132
This test validates the exact metadata fields that are sent from:
127133
- k8s watcher (session_started, session_resumed, session_hibernated, session_stopped)
128134
- notebooks.core_sessions (user_requested_session_resume)
129135
"""
136+
130137
# Create mock metrics repo
131138
async def mock_store_event(*args, **kwargs):
132139
pass
@@ -135,10 +142,14 @@ async def mock_store_event(*args, **kwargs):
135142
metrics = StagingMetricsService(enabled=True, metrics_repo=mock_metrics_repo)
136143

137144
# Create mock user
138-
mock_user = type("APIUser", (), {
139-
"id": "test-user-123",
140-
"is_authenticated": True,
141-
})()
145+
mock_user = type(
146+
"APIUser",
147+
(),
148+
{
149+
"id": "test-user-123",
150+
"is_authenticated": True,
151+
},
152+
)()
142153

143154
# Test ALL the metadata fields that are actually sent in the implementation
144155
# From: components/renku_data_services/k8s/watcher/core.py:208-219 (session_started/resumed)

0 commit comments

Comments
 (0)