Skip to content

Commit 20ea338

Browse files
committed
feat(u3c): Add test on simulated lock app
Feel free to stress test by doing negative testing and changes usernames (using spaces or escapes). May delete commands produce retained events. Further negative testing will not hurt. Relate-to: SiliconLabsSoftware#144 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 6bfff41 commit 20ea338

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

scripts/tests/z-wave-stack-binaries-test.sh

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,92 @@ play_node_soc_door_lock_keypad_()
606606
json='{"value":"'$value'"}'
607607
expect="$sub $json"
608608
pubsub_ "$pub" "$message" "$sub" "$expect"
609+
610+
type="UserCredential"
611+
command="AddUser"
612+
ep="ep0/$type/Commands/$command"
613+
pub="ucl/by-unid/$nodeunid/$ep"
614+
local userid=1
615+
local usertype='ProgrammingUser'
616+
617+
message='
618+
{
619+
"UserUniqueID": '$userid',
620+
"UserType": "'$usertype'",
621+
"UserActiveState": false,
622+
"CredentialRule": "Single",
623+
"UserName": "Admin",
624+
"ExpiringTimeoutMinutes": 0,
625+
"UserNameEncoding": "ASCII"
626+
}
627+
'
628+
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/User/$userid/UserName/Reported"
629+
expect='{"value":"Admin"}'
630+
expect="$sub $expect"
631+
pubsub_ "$pub" "$message" "$sub" "$expect"
632+
633+
userid=2
634+
usertype='GeneralUser'
635+
message='
636+
{
637+
"UserUniqueID": '$userid',
638+
"UserType": "'$usertype'",
639+
"UserActiveState": false,
640+
"CredentialRule": "Single",
641+
"UserName": "",
642+
"ExpiringTimeoutMinutes": 0,
643+
"UserNameEncoding": "ASCII"
644+
}
645+
'
646+
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/User/$userid/UserName/Reported"
647+
expect='{"value":"User-'$userid'"}'
648+
expect="$sub $expect"
649+
pubsub_ "$pub" "$message" "$sub" "$expect"
650+
651+
command='AddCredential'
652+
ep="ep0/$type/Commands/$command"
653+
pub="ucl/by-unid/$nodeunid/$ep"
654+
value=1234
655+
message='{
656+
"UserUniqueID": '$userid',
657+
"CredentialType": "PINCode",
658+
"CredentialSlot": 5,
659+
"CredentialData": "'$value'"
660+
}'
661+
ep="ep0/UserCredential/Attributes/User/2/Credential/PINCode/5/CredentialData/Reported"
662+
sub="ucl/by-unid/$nodeunid/$ep"
663+
expect='{"value":"'$value'"}'
664+
expect="$sub $expect"
665+
pubsub_ "$pub" "$message" "$sub" "$expect"
666+
667+
command='ModifyCredential'
668+
ep="ep0/$type/Commands/$command"
669+
pub="ucl/by-unid/$nodeunid/$ep"
670+
value=5678
671+
message='{
672+
"UserUniqueID": '$userid',
673+
"CredentialType": "PINCode",
674+
"CredentialSlot": 5,
675+
"CredentialData": "'$value'"
676+
}'
677+
expect='{"value":"'$value'"}'
678+
expect="$sub $expect"
679+
pubsub_ "$pub" "$message" "$sub" "$expect"
680+
681+
command='DeleteAllCredentials'
682+
ep="ep0/$type/Commands/$command"
683+
pub="ucl/by-unid/$nodeunid/$ep"
684+
message='{}'
685+
sub="ucl/by-unid/$nodeunid/ep0/$type/Attributes/User/+/Credential/PINCode/+/CredentialModifierNodeId/Reported"
686+
expect="$sub (null)"
687+
pub_ "$pub" "$message" # Not retained ?
688+
689+
command="DeleteAllUsers"
690+
ep="ep0/$type/Commands/$command"
691+
pub="ucl/by-unid/$nodeunid/$ep"
692+
message='{}'
693+
sub="ucl/by-unid/$nodeunid/ep0/UserCredential/Attributes/User/1/UserName/Reported"
694+
pub_ "$pub" "$message" # Not retained ?
609695
}
610696

611697

0 commit comments

Comments
 (0)