|
27 | 27 | # === END CI TEST ARGUMENTS ===
|
28 | 28 |
|
29 | 29 | import logging
|
| 30 | +import random |
| 31 | +import string |
30 | 32 |
|
31 | 33 | import chip.clusters as Clusters
|
32 | 34 | from chip.clusters.Types import NullValue
|
|
35 | 37 | from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main, type_matches
|
36 | 38 | from mobly import asserts
|
37 | 39 |
|
| 40 | + |
38 | 41 | logger = logging.getLogger(__name__)
|
39 | 42 |
|
40 | 43 | drlkcluster = Clusters.DoorLock
|
@@ -165,17 +168,20 @@ async def read_attributes_from_dut(self, endpoint, cluster, attribute, expected_
|
165 | 168 | def pics_TC_DRLK_2_9(self) -> list[str]:
|
166 | 169 | return ["DRLK.S"]
|
167 | 170 |
|
| 171 | + async def generate_max_pincode_len(self, maxPincodeLength): |
| 172 | + return ''.join(random.choices(string.digits, k=maxPincodeLength)) |
| 173 | + |
168 | 174 | async def generate_code(self):
|
169 | 175 |
|
170 |
| - validpincodestr = await self.generate_pincode(self.maxpincodelength) |
| 176 | + validpincodestr = await self.generate_max_pincode_len(self.maxpincodelength) |
171 | 177 | self.pin_code = bytes(validpincodestr, 'ascii')
|
172 |
| - validpincodestr = await self.generate_pincode(self.maxpincodelength) |
| 178 | + validpincodestr = await self.generate_max_pincode_len(self.maxpincodelength) |
173 | 179 | self.pin_code1 = bytes(validpincodestr, 'ascii')
|
174 |
| - validpincodestr = await self.generate_pincode(self.maxpincodelength) |
| 180 | + validpincodestr = await self.generate_max_pincode_len(self.maxpincodelength) |
175 | 181 | self.pin_code2 = bytes(validpincodestr, 'ascii')
|
176 |
| - inavlidpincodestr = await self.generate_pincode(self.maxpincodelength+1) |
| 182 | + inavlidpincodestr = await self.generate_max_pincode_len(self.maxpincodelength+1) |
177 | 183 | self.inavlid_pincode = bytes(inavlidpincodestr, 'ascii')
|
178 |
| - validpincodestr = await self.generate_pincode(self.maxrfidcodelength) |
| 184 | + validpincodestr = await self.generate_max_pincode_len(self.maxrfidcodelength) |
179 | 185 | self.rfid_tag = bytes(validpincodestr, 'ascii')
|
180 | 186 |
|
181 | 187 | async def send_clear_user_cmd(self, user_index, expected_status: Status = Status.Success):
|
@@ -595,7 +601,7 @@ async def test_TC_DRLK_2_9(self):
|
595 | 601 | start_credential_index = 1
|
596 | 602 | nextCredentialIndex = 1
|
597 | 603 | while 1:
|
598 |
| - uniquePincodeString = await self.generate_pincode(self.maxpincodelength) |
| 604 | + uniquePincodeString = await self.generate_max_pincode_len(self.maxpincodelength) |
599 | 605 | uniquePincode = bytes(uniquePincodeString, 'ascii')
|
600 | 606 | logging.info("Credential Data value is %s" % (uniquePincode))
|
601 | 607 | if start_credential_index <= (numberofcredentialsupportedperuser):
|
|
0 commit comments