forked from project-chip/connectedhomeip
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbccc78
commit 8d17dec
Showing
3 changed files
with
183 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# | ||
# Copyright (c) 2024 Project CHIP Authors | ||
# All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# test-runner-runs: run1 | ||
# test-runner-run/run1/app: ${ALL_CLUSTERS_APP} | ||
# test-runner-run/run1/factoryreset: True | ||
# test-runner-run/run1/quiet: True | ||
# test-runner-run/run1/app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json | ||
# test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto | ||
|
||
import logging | ||
import random | ||
|
||
import chip.clusters as Clusters | ||
from chip.exceptions import ChipStackError | ||
from matter_testing_support import InternalTestRunnerHooks, MatterBaseTest, MatterTestConfig, async_test_body, parse_matter_test_args, run_tests | ||
from mobly import asserts | ||
|
||
|
||
class TC_CGEN_2_6(MatterBaseTest): | ||
|
||
async def test_TC_CGEN_2_6(self): | ||
info = self.get_setup_payload_info()[0] | ||
|
||
self.th1 = self.default_controller | ||
self.discriminator = random.randint(0, 4095) | ||
|
||
logging.info('Step 1 - TH commissions the DUT without setting TCs') | ||
|
||
# Don't set TCs for the next commissioning and skip CommissioningComplete so we can manually call CommissioningComplete in order to check the response error code | ||
self.th1.SetTCRequired(False) | ||
self.th1.SetSkipCommissioningComplete(True) | ||
|
||
await self.default_controller.CommissionOnNetwork( | ||
nodeId=self.dut_node_id, | ||
setupPinCode=info.passcode, | ||
filterType=info.filter_type, | ||
filter=info.filter_value | ||
) | ||
|
||
cmd = Clusters.GeneralCommissioning.Commands.CommissioningComplete() | ||
resp = await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=cmd, timedRequestTimeoutMs=6000) | ||
asserts.assert_equal(resp.errorCode, Clusters.GeneralCommissioning.Enums.CommissioningErrorEnum.kTCAcknowledgementsNotReceived, 'Incorrect error code') | ||
|
||
|
||
if __name__ == "__main__": | ||
config: MatterTestConfig = parse_matter_test_args() | ||
|
||
# When commissioning_method is set, the MatterBaseTest inherently depends on CommissionDeviceTest, which we want to avoid to test commissioning failure cases | ||
config.commissioning_method = None | ||
|
||
run_tests(TC_CGEN_2_6, config, InternalTestRunnerHooks()) |