|
| 1 | +# |
| 2 | +# Copyright (c) 2024 Project CHIP Authors |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | + |
| 18 | +import chip.clusters as Clusters |
| 19 | +from matter_testing_support import MatterBaseTest, TestStep, default_matter_test_main, has_cluster, per_endpoint_test |
| 20 | +from mobly import asserts |
| 21 | + |
| 22 | + |
| 23 | +class TC_CCTRL_2_1(MatterBaseTest): |
| 24 | + |
| 25 | + def steps_TC_CCTRL_2_1(self) -> list[TestStep]: |
| 26 | + steps = [TestStep(1, "Read MCORE.FS PICS code", is_commissioning=True), |
| 27 | + TestStep(2, "Validate SupportedDeviceCategories is set accordingly based on MCORE.FS")] |
| 28 | + return steps |
| 29 | + |
| 30 | + @per_endpoint_test(has_cluster(Clusters.CommissionerControl)) |
| 31 | + async def test_TC_CCTRL_2_1(self): |
| 32 | + self.step(1) |
| 33 | + is_fabric_sync_pics_enabled = self.check_pics("MCORE.FS") |
| 34 | + |
| 35 | + self.step(2) |
| 36 | + supported_device_categories = await self.read_single_attribute_check_success(cluster=Clusters.CommissionerControl, attribute=Clusters.CommissionerControl.Attributes.SupportedDeviceCategories) |
| 37 | + is_fabric_sync_bit_set = bool(supported_device_categories & |
| 38 | + Clusters.CommissionerControl.Bitmaps.SupportedDeviceCategoryBitmap.kFabricSynchronization) |
| 39 | + asserts.assert_equal(is_fabric_sync_bit_set, is_fabric_sync_pics_enabled, |
| 40 | + "Mismatch between PICS MCORE.FS value and what attribute indicates") |
| 41 | + |
| 42 | + |
| 43 | +if __name__ == "__main__": |
| 44 | + default_matter_test_main() |
0 commit comments