forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_app_client_response_models.py
More file actions
60 lines (46 loc) · 1.85 KB
/
Copy pathtest_app_client_response_models.py
File metadata and controls
60 lines (46 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from typing import Optional
from pydantic import TypeAdapter
from routers.apps import UnapprovedPublicAppResponse
from routers.mcp import McpScreenActivitySummaryResponse
from routers.users import AIUserProfileResponse, AssistantSettingsResponse
def test_ai_profile_response_preserves_missing_profile_null():
adapter = TypeAdapter(Optional[AIUserProfileResponse])
assert adapter.validate_python(None) is None
def test_assistant_settings_response_keeps_forward_compatible_sections():
response = AssistantSettingsResponse.model_validate(
{
'focus': {'enabled': True},
'update_channel': 'beta',
'future_section': {'enabled': False, 'threshold': 3},
}
)
assert response.model_dump()['future_section'] == {'enabled': False, 'threshold': 3}
def test_unapproved_public_app_response_tolerates_legacy_partial_docs():
response = UnapprovedPublicAppResponse.model_validate(
{
'id': 'legacy-app',
'approved': False,
'private': False,
'unexpected_admin_note': 'needs cleanup',
}
)
assert response.id == 'legacy-app'
assert response.capabilities == []
assert response.model_dump()['unexpected_admin_note'] == 'needs cleanup'
def test_mcp_screen_activity_summary_response_models_known_shape():
response = McpScreenActivitySummaryResponse.model_validate(
{
'apps': {
'Omi': {
'count': 2,
'first_seen': '2026-07-03T10:00:00Z',
'last_seen': '2026-07-03T10:05:00Z',
'window_titles': ['Main'],
}
},
'total_screenshots': 2,
}
)
assert response.apps['Omi'].count == 2
assert response.apps['Omi'].window_titles == ['Main']
assert response.total_screenshots == 2