Skip to content

Commit

Permalink
Add tests in DL_LockUnlock yaml to validate Lock/Unlock credentials a…
Browse files Browse the repository at this point in the history
…nd userIndex (#24992) (#25030)

* Add tests in DL_LockUnlock yaml: (#24992)
- verify correct CredentialIndex on LockOperation events
- verify NULL UserIndex and Credentials on LockOperation errors when using invalid PINCodes
Fixes #24992

* Restyled by prettier-yaml

* Exclude DL_LockUnlock yaml test from Darwin (waiting on readEvent support)

---------

Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Sep 29, 2023
1 parent 0b5bd54 commit 1269480
Show file tree
Hide file tree
Showing 4 changed files with 324 additions and 1,345 deletions.
3 changes: 2 additions & 1 deletion examples/darwin-framework-tool/templates/tests/ciTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"Test_TC_ACL_2_7",
"Test_TC_ACL_2_8",
"Test_TC_ACL_2_9",
"Test_TC_ACL_2_10"
"Test_TC_ACL_2_10",
"DL_LockUnlock"
]
}
92 changes: 85 additions & 7 deletions src/app/tests/suites/DL_LockUnlock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ config:
nodeId: 0x12344321
cluster: "Door Lock"
endpoint: 1
timeout: 15

tests:
- label: "Wait for the commissioned device to be retrieved"
Expand Down Expand Up @@ -48,19 +49,41 @@ tests:
response:
value: 1

- label: "Create new PIN credential and lock/unlock user"
- label: "Create new lock/unlock user"
command: "SetUser"
timedInteractionTimeoutMs: 10000
arguments:
values:
- name: "OperationType"
value: 0
- name: "UserIndex"
value: 1
- name: "UserName"
value: "xxx"
- name: "UserUniqueID"
value: 6452
- name: "UserStatus"
value: 1
- name: "UserType"
value: 0
- name: "CredentialRule"
value: 0

- label:
"Create new PIN credential and associate it with lock/unlock user,
with userIndex != credentialIndex"
command: "SetCredential"
timedInteractionTimeoutMs: 10000
arguments:
values:
- name: "OperationType"
value: 0
- name: "Credential"
value: { CredentialType: 1, CredentialIndex: 1 }
value: { CredentialType: 1, CredentialIndex: 2 }
- name: "CredentialData"
value: "123456"
- name: "UserIndex"
value: null
value: 1
- name: "UserStatus"
value: null
- name: "UserType"
Expand All @@ -70,9 +93,9 @@ tests:
- name: "Status"
value: 0x00
- name: "UserIndex"
value: 1
value: null
- name: "NextCredentialIndex"
value: 2
value: 3

- label:
"Set the WrongCodeEntryLimit to big value so that we can test
Expand Down Expand Up @@ -106,6 +129,36 @@ tests:
- name: "PINCode"
value: "123456"

- label: "Read the LockOperation event list"
command: "readEvent"
event: "LockOperation"
response:
- values:
- value:
{
"LockOperationType": 1,
"OperationSource": 7,
"UserIndex": null,
"Credentials": null,
}
- values:
- value:
{
"LockOperationType": 0,
"OperationSource": 7,
"UserIndex": null,
"Credentials": null,
}
- values:
- value:
{
"LockOperationType": 1,
"OperationSource": 7,
"UserIndex": 1,
"Credentials":
[{ "CredentialType": 1, "CredentialIndex": 2 }],
}

- label: "Verify that lock state attribute value is set to Unlocked"
command: "readAttribute"
attribute: "LockState"
Expand All @@ -122,6 +175,31 @@ tests:
response:
error: FAILURE

- label:
"Read the LockOperationError event list; verify null UserIndex and
Credentials"
command: "readEvent"
event: "LockOperationError"
response:
- values:
- value:
{
"LockOperationType": 1,
"OperationSource": 7,
"OperationError": 1,
"UserIndex": null,
"Credentials": null,
}
- values:
- value:
{
"LockOperationType": 0,
"OperationSource": 7,
"OperationError": 1,
"UserIndex": null,
"Credentials": null,
}

- label: "Verify that lock state attribute value is set to Unlocked"
command: "readAttribute"
attribute: "LockState"
Expand Down Expand Up @@ -254,7 +332,7 @@ tests:
- name: "OperationType"
value: 0
- name: "Credential"
value: { CredentialType: 1, CredentialIndex: 2 }
value: { CredentialType: 1, CredentialIndex: 3 }
- name: "CredentialData"
value: "654321"
- name: "UserIndex"
Expand All @@ -270,7 +348,7 @@ tests:
- name: "UserIndex"
value: 2
- name: "NextCredentialIndex"
value: 3
value: 4

- label: "Try to unlock the door with disabled user PIN"
command: "UnlockDoor"
Expand Down
Loading

0 comments on commit 1269480

Please sign in to comment.