Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for configuring terms and conditions in device commissioning #173

Merged
merged 20 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
13c6737
Add support for configuring terms and conditions in device commissioning
swan-amazon Sep 10, 2024
3291de1
* Ran ./scripts/format.sh
swan-amazon Dec 16, 2024
d93aa82
swan-amazon Dec 16, 2024
6d7795c
Update test_collections/matter/test_environment_config.py
swan-amazon Dec 18, 2024
1ead31c
Update app/user_prompt_support/uploaded_file_support.py
swan-amazon Dec 18, 2024
d6c959d
Update test_collections/matter/sdk_tests/support/performance_tests/ut…
swan-amazon Dec 18, 2024
d7900b7
Update test_collections/matter/sdk_tests/support/python_testing/model…
swan-amazon Dec 18, 2024
3061a7f
Update test_collections/matter/sdk_tests/support/python_testing/model…
swan-amazon Dec 18, 2024
3a31d06
Update test_collections/matter/sdk_tests/support/python_testing/__ini…
swan-amazon Dec 18, 2024
2b2c6b3
Revert changes to test_collections/matter/sdk_tests/support/performan…
swan-amazon Dec 19, 2024
d42f6c1
Restyle test_environment_config.py
swan-amazon Dec 19, 2024
d567a1b
test: Add in-test-commissioning-method parameter for manual commissio…
swan-amazon Dec 19, 2024
0f0fc83
Add new field "enhanced_setup_flow" to exception message
swan-amazon Dec 20, 2024
75a3afe
Merge remote-tracking branch 'origin/v2.12' into esf
swan-amazon Dec 20, 2024
2cd99b7
Cherry-pick test_python_parser.py from origin/main
swan-amazon Dec 20, 2024
5d65ce5
Cherry-pick python_test_parser.py from origin/main
swan-amazon Dec 20, 2024
ff8943b
Revert "Cherry-pick python_test_parser.py from origin/main"
swan-amazon Dec 20, 2024
f17722d
Revert "Cherry-pick test_python_parser.py from origin/main"
swan-amazon Dec 20, 2024
48c0e32
Removed broken test `test_python_parser.py`
swan-amazon Dec 20, 2024
8b89894
Revert "Removed broken test `test_python_parser.py`"
swan-amazon Dec 21, 2024
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
4 changes: 2 additions & 2 deletions app/tests/api/api_v1/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_create_project_invalid_dut_config(client: TestClient) -> None:
"detail": "The informed configuration has one or more invalid properties. "
"Exception message: The field invalid_arg is not a valid dut_config "
"configuration: ['discriminator', 'setup_code', 'pairing_mode', "
"'chip_timeout', 'chip_use_paa_certs', 'trace_log']"
"'chip_timeout', 'chip_use_paa_certs', 'trace_log', 'enhanced_setup_flow']"
},
expected_keys=["detail"],
)
Expand Down Expand Up @@ -261,7 +261,7 @@ def test_update_project_invalid_dut_config(client: TestClient, db: Session) -> N
"detail": "The informed configuration has one or more invalid properties. "
"Exception message: The field invalid_arg is not a valid dut_config "
"configuration: ['discriminator', 'setup_code', 'pairing_mode', "
"'chip_timeout', 'chip_use_paa_certs', 'trace_log']"
"'chip_timeout', 'chip_use_paa_certs', 'trace_log', 'enhanced_setup_flow']"
},
expected_keys=["detail"],
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2023 Project CHIP Authors
# Copyright (c) 2023-2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,19 @@ async def generate_command_arguments(
if dut_config.trace_log:
arguments.append("--trace-to json:log")

if not omit_commissioning_method:
if dut_config.enhanced_setup_flow:
arguments.append("--require-tc-acknowledgements 1")
arguments.append(
f"--tc-acknowledgements {dut_config.enhanced_setup_flow.tc_user_response}"
)
arguments.append(
f"--tc-acknowledgements-version {dut_config.enhanced_setup_flow.tc_version}"
)

if omit_commissioning_method:
arguments.append(f"--in-test-commissioning-method {pairing_mode}")

else:
arguments.append(f"--commissioning-method {pairing_mode}")

if pairing_mode == DutPairingModeEnum.BLE_WIFI:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ async def test_generate_command_arguments_omit_comissioning_method() -> None:

assert [
"--trace-to json:log",
"--in-test-commissioning-method on-network",
"--discriminator 456",
"--passcode 8765",
] == arguments
Expand Down
10 changes: 9 additions & 1 deletion test_collections/matter/test_environment_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ class NetworkConfig(BaseModel):
thread: Union[ThreadAutoConfig, ThreadExternalConfig]


class EnhancedSetupFlowConfig(BaseModel):
tc_version: int
tc_user_response: int


class DutConfig(BaseModel):
discriminator: str
setup_code: str
pairing_mode: DutPairingModeEnum
chip_timeout: Optional[str]
chip_use_paa_certs: bool = False
trace_log: bool = True
enhanced_setup_flow: Optional[EnhancedSetupFlowConfig] = None


class TestEnvironmentConfigMatter(TestEnvironmentConfig):
Expand Down Expand Up @@ -96,9 +102,11 @@ def validate_model(self, dict_model: dict) -> None:
f" {valid_properties}"
)

# All DutConfig fields but chip_timeout are mandatory
# All DutConfig fields but chip_timeout and enhanced_setup_flow are
# mandatory
mandatory_fields = valid_properties.copy()
mandatory_fields.remove("chip_timeout")
mandatory_fields.remove("enhanced_setup_flow")
for field in mandatory_fields:
if field not in dut_config:
raise TestEnvironmentConfigMatterError(
Expand Down
Loading