forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_assistant_settings_response_models.py
More file actions
40 lines (29 loc) · 1.46 KB
/
Copy pathtest_assistant_settings_response_models.py
File metadata and controls
40 lines (29 loc) · 1.46 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
import json
from pathlib import Path
from routers.users import AssistantSettingsResponse
ROOT_DIR = Path(__file__).resolve().parents[3]
SPEC_PATH = ROOT_DIR / 'docs' / 'api-reference' / 'app-client-openapi.json'
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_assistant_settings_model_schema_exposes_known_fields_and_allows_future_sections():
schema = AssistantSettingsResponse.model_json_schema()
assert schema['title'] == 'AssistantSettingsResponse'
assert schema.get('additionalProperties') is True
assert {'shared', 'focus', 'task', 'advice', 'memory', 'floating_bar', 'update_channel'} <= set(
schema['properties']
)
def test_app_client_openapi_assistant_settings_response_exposes_known_fields_and_allows_future_sections():
spec = json.loads(SPEC_PATH.read_text(encoding='utf-8'))
schema = spec['components']['schemas']['AssistantSettingsResponse']
assert schema['title'] == 'AssistantSettingsResponse'
assert schema.get('additionalProperties') is True
assert {'shared', 'focus', 'task', 'advice', 'memory', 'floating_bar', 'update_channel'} <= set(
schema['properties']
)