Skip to content

Commit 87107b3

Browse files
author
Datata1
committed
nits
1 parent 67f3d99 commit 87107b3

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

examples/scripts/create_workspace_with_landscape.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212
from codesphere.resources.workspace.logs import LogStage
1313

14-
TEAM_ID = 35698
14+
TEAM_ID = 123
1515

1616

1717
async def main():
@@ -29,7 +29,6 @@ async def main():
2929
)
3030
print(f"✓ Workspace created (ID: {workspace.id})")
3131

32-
# Get the team for usage history access
3332
team = await sdk.teams.get(team_id=TEAM_ID)
3433

3534
print("Waiting for workspace to start...")
@@ -94,9 +93,6 @@ async def main():
9493

9594
print(f"\n✓ Stream ended ({count} log entries)")
9695

97-
# ========================================
98-
# Usage History Collection
99-
# ========================================
10096
print("\n--- Usage History ---")
10197

10298
end_date = datetime.now(timezone.utc)

tests/resources/team/usage/test_usage.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
@pytest.fixture
1616
def sample_usage_summary_data():
17-
"""Sample response data for landscape service usage summary."""
1817
return {
1918
"totalItems": 3,
2019
"limit": 25,
@@ -230,7 +229,6 @@ def test_total_pages(self):
230229
assert response.total_pages == 4
231230

232231
def test_total_pages_with_remainder(self):
233-
"""total_pages should round up when items don't divide evenly."""
234232
response = UsageSummaryResponse(
235233
total_items=101,
236234
limit=25,
@@ -243,10 +241,7 @@ def test_total_pages_with_remainder(self):
243241

244242

245243
class TestUsageSummaryResponse:
246-
"""Tests for the UsageSummaryResponse schema."""
247-
248244
def test_parse_full_response(self, sample_usage_summary_data):
249-
"""Should correctly parse a full usage summary response."""
250245
response = UsageSummaryResponse.model_validate(sample_usage_summary_data)
251246

252247
assert response.total_items == 3
@@ -256,18 +251,14 @@ def test_parse_full_response(self, sample_usage_summary_data):
256251
assert len(response.items) == 3
257252

258253
def test_items_property(self, sample_usage_summary_data):
259-
"""items property should return the summary list."""
260254
response = UsageSummaryResponse.model_validate(sample_usage_summary_data)
261255

262256
assert response.items is response.summary
263257
assert isinstance(response.items[0], LandscapeServiceSummary)
264258

265259

266260
class TestUsageEventsResponse:
267-
"""Tests for the UsageEventsResponse schema."""
268-
269261
def test_parse_full_response(self, sample_usage_events_data):
270-
"""Should correctly parse a full usage events response."""
271262
response = UsageEventsResponse.model_validate(sample_usage_events_data)
272263

273264
assert response.total_items == 4
@@ -277,19 +268,15 @@ def test_parse_full_response(self, sample_usage_events_data):
277268
assert len(response.items) == 4
278269

279270
def test_items_property(self, sample_usage_events_data):
280-
"""items property should return the events list."""
281271
response = UsageEventsResponse.model_validate(sample_usage_events_data)
282272

283273
assert response.items is response.events
284274
assert isinstance(response.items[0], LandscapeServiceEvent)
285275

286276

287277
class TestTeamUsageManager:
288-
"""Tests for the TeamUsageManager class."""
289-
290278
@pytest.fixture
291279
def usage_manager(self, mock_http_client_for_resource, sample_usage_summary_data):
292-
"""Create a TeamUsageManager with mock HTTP client."""
293280
mock_client = mock_http_client_for_resource(sample_usage_summary_data)
294281
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
295282
return manager, mock_client
@@ -298,7 +285,6 @@ def usage_manager(self, mock_http_client_for_resource, sample_usage_summary_data
298285
async def test_get_landscape_summary(
299286
self, mock_http_client_for_resource, sample_usage_summary_data
300287
):
301-
"""get_landscape_summary should return UsageSummaryResponse."""
302288
mock_client = mock_http_client_for_resource(sample_usage_summary_data)
303289
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
304290

@@ -316,7 +302,6 @@ async def test_get_landscape_summary(
316302
async def test_get_landscape_summary_with_pagination(
317303
self, mock_http_client_for_resource, sample_usage_summary_data
318304
):
319-
"""get_landscape_summary should pass pagination parameters."""
320305
mock_client = mock_http_client_for_resource(sample_usage_summary_data)
321306
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
322307

@@ -336,11 +321,9 @@ async def test_get_landscape_summary_with_pagination(
336321
async def test_get_landscape_summary_clamps_limit(
337322
self, mock_http_client_for_resource, sample_usage_summary_data
338323
):
339-
"""get_landscape_summary should clamp limit to 1-100 range."""
340324
mock_client = mock_http_client_for_resource(sample_usage_summary_data)
341325
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
342326

343-
# Test upper bound
344327
await manager.get_landscape_summary(
345328
begin_date=datetime(2024, 1, 1),
346329
end_date=datetime(2024, 1, 31),
@@ -353,7 +336,6 @@ async def test_get_landscape_summary_clamps_limit(
353336
async def test_get_landscape_events(
354337
self, mock_http_client_for_resource, sample_usage_events_data
355338
):
356-
"""get_landscape_events should return UsageEventsResponse."""
357339
mock_client = mock_http_client_for_resource(sample_usage_events_data)
358340
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
359341

@@ -372,7 +354,6 @@ async def test_get_landscape_events(
372354
async def test_iter_all_landscape_summary(
373355
self, mock_http_client_for_resource, sample_usage_summary_data
374356
):
375-
"""iter_all_landscape_summary should yield all items across pages."""
376357
mock_client = mock_http_client_for_resource(sample_usage_summary_data)
377358
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
378359

@@ -390,7 +371,6 @@ async def test_iter_all_landscape_summary(
390371
async def test_iter_all_landscape_events(
391372
self, mock_http_client_for_resource, sample_usage_events_data
392373
):
393-
"""iter_all_landscape_events should yield all items across pages."""
394374
mock_client = mock_http_client_for_resource(sample_usage_events_data)
395375
manager = TeamUsageManager(http_client=mock_client, team_id=12345)
396376

@@ -407,11 +387,8 @@ async def test_iter_all_landscape_events(
407387

408388

409389
class TestTeamUsageProperty:
410-
"""Tests for the Team.usage property."""
411-
412390
@pytest.mark.asyncio
413391
async def test_team_has_usage_property(self, team_model_factory):
414-
"""Team model should have a usage property that returns TeamUsageManager."""
415392
team, _ = team_model_factory()
416393

417394
usage_manager = team.usage

0 commit comments

Comments
 (0)