Skip to content

Commit

Permalink
Add tests in DL_LockUnlock yaml: (project-chip#24992)
Browse files Browse the repository at this point in the history
- verify correct CredentialIndex on LockOperation events
- verify NULL UserIndex and Credentials on LockOperation errors when using invalid PINCodes
Fixes project-chip#24992
  • Loading branch information
jrhees-cae committed Feb 13, 2023
1 parent 9508b52 commit 30760d1
Show file tree
Hide file tree
Showing 3 changed files with 444 additions and 241 deletions.
55 changes: 48 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,39 @@ 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 +91,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 +127,17 @@ 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 +154,15 @@ 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 +295,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 +311,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 30760d1

Please sign in to comment.