Skip to content

Commit b36acf0

Browse files
Merge pull request #158 from zigbee-alliance/not-found-fix
2 parents c69d26c + 8fd3b52 commit b36acf0

File tree

149 files changed

+2723
-2068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+2723
-2068
lines changed

docs/static/openapi.yml

+876-18
Large diffs are not rendered by default.

integration_tests/cli/auth-demo.sh

+60-7
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,35 @@ user_pubkey=$(echo $passphrase | dcld keys show $user -p)
3434
vid=$RANDOM
3535
pid=$RANDOM
3636

37+
echo "Get not yet approved $user account"
38+
result=$(dcld query auth account --address=$user_address)
39+
check_response "$result" "Not Found"
40+
41+
test_divider
42+
43+
echo "Get not yet proposed $user account to revoke"
44+
result=$(dcld query auth proposed-account-to-revoke --address=$user_address)
45+
check_response "$result" "Not Found"
46+
47+
test_divider
48+
3749
echo "Get not yet proposed $user account"
38-
result=$(dcld query auth account --address=$user_address 2>&1) || true
39-
check_response "$result" "null"
50+
result=$(dcld query auth proposed-account --address=$user_address)
51+
check_response "$result" "Not Found"
52+
53+
test_divider
54+
55+
echo "Get all proposed accounts must be empty"
56+
result=$(dcld query auth all-proposed-accounts)
57+
check_response "$result" "\[\]"
58+
response_does_not_contain "$result" "\"address\": \"$user_address\""
59+
60+
test_divider
61+
62+
echo "Get all proposed accounts to revoke must be empty"
63+
result=$(dcld query auth all-proposed-accounts-to-revoke)
64+
check_response "$result" "\[\]"
65+
response_does_not_contain "$result" "\"address\": \"$user_address\""
4066

4167
test_divider
4268

@@ -52,6 +78,16 @@ response_does_not_contain "$result" "\"address\": \"$user_address\""
5278

5379
test_divider
5480

81+
echo "Get an account for $user is not found"
82+
result=$(dcld query auth account --address=$user_address)
83+
check_response "$result" "Not Found"
84+
85+
echo "Get a proposed account for $user"
86+
result=$(dcld query auth proposed-account --address=$user_address)
87+
check_response "$result" "\"address\": \"$user_address\""
88+
89+
test_divider
90+
5591
echo "Get all proposed accounts. $user account in the list"
5692
result=$(dcld query auth all-proposed-accounts)
5793
check_response "$result" "\"address\": \"$user_address\""
@@ -94,6 +130,12 @@ check_response_and_report "$result" "\"address\": \"$user_address\""
94130

95131
test_divider
96132

133+
echo "Get a proposed account for $user is not found"
134+
result=$(dcld query auth proposed-account --address=$user_address)
135+
check_response "$result" "Not Found"
136+
137+
test_divider
138+
97139
productName="Device #1"
98140
echo "$user adds Model with VID: $vid PID: $pid"
99141
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --from=$user_address --yes)
@@ -109,7 +151,7 @@ check_response_and_report "$result" "transaction should be signed by a vendor ac
109151
test_divider
110152

111153
echo "$user updates Model with VID: $vid PID: $pid"
112-
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --partNumber=12 --from=$user_address --yes 2>&1) || true
154+
result=$(echo "test1234" | dcld tx model update-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --partNumber=12 --from=$user_address --yes)
113155
check_response_and_report "$result" "\"code\": 0"
114156

115157
test_divider
@@ -149,6 +191,12 @@ check_response "$result" "\"address\": \"$user_address\""
149191

150192
test_divider
151193

194+
echo "Get a proposed account to revoke for $user"
195+
result=$(dcld query auth proposed-account-to-revoke --address="$user_address")
196+
check_response "$result" "\"address\": \"$user_address\""
197+
198+
test_divider
199+
152200
echo "Bob approves to revoke account for $user"
153201
result=$(echo $passphrase | dcld tx auth approve-revoke-account --address="$user_address" --from bob --yes)
154202
check_response "$result" "\"code\": 0"
@@ -173,17 +221,22 @@ check_response "$result" "\[\]"
173221

174222
test_divider
175223

176-
echo "Get $user account"
177-
result=$(dcld query auth account --address=$user_address 2>&1) || true
178-
check_response "$result" "null"
224+
echo "Get a proposed account to revoke for $user is not found"
225+
result=$(dcld query auth proposed-account-to-revoke --address="$user_address")
226+
check_response "$result" "Not Found"
179227

180228
test_divider
181229

230+
echo "Get $user account"
231+
result=$(dcld query auth account --address=$user_address)
232+
check_response "$result" "Not Found"
233+
234+
test_divider
182235

183236
pid=$RANDOM
184237
productName="Device #2"
185238
echo "$user adds Model with VID: $vid PID: $pid"
186239
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --productName="$productName" --productLabel="Device Description" --commissioningCustomFlow=0 --deviceTypeID=12 --partNumber=12 --from=$user_address --yes 2>&1) || true
187-
check_response "$result" "NotFound" raw
240+
check_response_and_report "$result" "key not found" raw
188241

189242
echo "PASSED"

integration_tests/cli/compliance-demo.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ test_divider
9797

9898
echo "Get Compliance Info with VID: ${vid} PID: ${pid} SV: ${sv} before compliance record was created"
9999
result=$(dcld query compliance compliance-info --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="zigbee")
100-
check_response "$result" "null"
100+
check_response "$result" "Not Found"
101101
response_does_not_contain "$result" "\"pid\": $pid"
102102
response_does_not_contain "$result" "\"vid\": $vid"
103103
echo $result
@@ -106,7 +106,7 @@ test_divider
106106

107107
echo "Get Certified Model with VID: ${vid} PID: ${pid} SV: ${sv} before compliance record was created"
108108
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="zigbee")
109-
check_response "$result" "null"
109+
check_response "$result" "Not Found"
110110
response_does_not_contain "$result" "\"pid\": $pid"
111111
response_does_not_contain "$result" "\"vid\": $vid"
112112
echo $result
@@ -115,7 +115,7 @@ test_divider
115115

116116
echo "Get Revoked Model with VID: ${vid} PID: ${pid} SV: ${sv} before compliance record was created"
117117
result=$(dcld query compliance revoked-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="zigbee")
118-
check_response "$result" "null"
118+
check_response "$result" "Not Found"
119119
response_does_not_contain "$result" "\"pid\": $pid"
120120
response_does_not_contain "$result" "\"vid\": $vid"
121121
echo "$result"
@@ -124,7 +124,7 @@ test_divider
124124

125125
echo "Get Revoked Model with VID: ${vid} PID: ${pid} SV: ${sv} before compliance record was created"
126126
result=$(dcld query compliance provisional-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="zigbee")
127-
check_response "$result" "null"
127+
check_response "$result" "Not Found"
128128
response_does_not_contain "$result" "\"pid\": $pid"
129129
response_does_not_contain "$result" "\"vid\": $vid"
130130
echo "$result"

integration_tests/cli/compliance-provisioning.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test_divider
9898

9999
echo "Get Certified Model with VID: ${vid} PID: ${pid} before compliance record was created for ZB"
100100
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_zb")
101-
check_response "$result" "null"
101+
check_response "$result" "Not Found"
102102
response_does_not_contain "$result" "\"pid\": $pid"
103103
response_does_not_contain "$result" "\"vid\": $vid"
104104
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_zb\""
@@ -108,7 +108,7 @@ test_divider
108108

109109
echo "Get Certified Model with VID: ${vid} PID: ${pid} before compliance record was created for Matter"
110110
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_matter")
111-
check_response "$result" "null"
111+
check_response "$result" "Not Found"
112112
response_does_not_contain "$result" "\"pid\": $pid"
113113
response_does_not_contain "$result" "\"vid\": $vid"
114114
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_matter\""
@@ -119,7 +119,7 @@ test_divider
119119

120120
echo "Get Revoked Model with VID: ${vid} PID: ${pid} and SV: ${sv} before compliance record was created for ZB"
121121
result=$(dcld query compliance revoked-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_zb")
122-
check_response "$result" "null"
122+
check_response "$result" "Not Found"
123123
response_does_not_contain "$result" "\"pid\": $pid"
124124
response_does_not_contain "$result" "\"vid\": $vid"
125125
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_zb\""
@@ -129,7 +129,7 @@ test_divider
129129

130130
echo "Get Revoked Model with VID: ${vid} PID: ${pid} and SV: ${sv} before compliance record was created for Matter"
131131
result=$(dcld query compliance revoked-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_matter")
132-
check_response "$result" "null"
132+
check_response "$result" "Not Found"
133133
response_does_not_contain "$result" "\"pid\": $pid"
134134
response_does_not_contain "$result" "\"vid\": $vid"
135135
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_matter\""

integration_tests/cli/compliance-revocation.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ test_divider
7979

8080
echo "Get Certified Model with VID: ${vid} PID: ${pid} before compliance record was created for ZB"
8181
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type")
82-
check_response "$result" "null"
82+
check_response "$result" "Not Found"
8383
response_does_not_contain "$result" "\"pid\": $pid"
8484
response_does_not_contain "$result" "\"vid\": $vid"
8585
response_does_not_contain "$result" "\"certification_type\": \"$certification_type\""
@@ -89,7 +89,7 @@ test_divider
8989

9090
echo "Get Certified Model with VID: ${vid} PID: ${pid} before compliance record was created for Matter"
9191
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_matter")
92-
check_response "$result" "null"
92+
check_response "$result" "Not Found"
9393
response_does_not_contain "$result" "\"pid\": $pid"
9494
response_does_not_contain "$result" "\"vid\": $vid"
9595
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_matter\""
@@ -179,7 +179,7 @@ test_divider
179179

180180
echo "Get Provisional Model with VID: ${vid} PID: ${pid} SV: ${sv} for zigbee certification"
181181
result=$(dcld query compliance provisional-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType=$certification_type)
182-
check_response "$result" "null"
182+
check_response "$result" "Not Found"
183183
response_does_not_contain "$result" "\"pid\": $pid"
184184
response_does_not_contain "$result" "\"vid\": $vid"
185185
echo "$result"
@@ -261,7 +261,7 @@ test_divider
261261

262262
echo "Get Certified Model with VID: ${vid} PID: ${pid} and SV: ${sv} for Matter"
263263
result=$(dcld query compliance certified-model --vid=$vid --pid=$pid --softwareVersion=$sv --certificationType="$certification_type_matter")
264-
check_response "$result" "null"
264+
check_response "$result" "Not Found"
265265
response_does_not_contain "$result" "\"pid\": $pid"
266266
response_does_not_contain "$result" "\"vid\": $vid"
267267
response_does_not_contain "$result" "\"certification_type\": \"$certification_type_matter\""

integration_tests/cli/compliancetest-demo.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_divider
4848
echo "Get Testing Result for Unknown Model"
4949
unknown_pid=$RANDOM
5050
result=$(dcld query compliancetest test-result --vid=$vid --pid=$unknown_pid --softwareVersion=$sv)
51-
check_response "$result" "null"
51+
check_response "$result" "Not Found"
5252
response_does_not_contain "$result" "\"pid\": $unknown_pid"
5353
response_does_not_contain "$result" "\"vid\": $vid"
5454
echo "$result"
@@ -57,7 +57,7 @@ test_divider
5757

5858
echo "Get Testing Result for Unknown Test Results"
5959
result=$(dcld query compliancetest test-result --vid=$vid --pid=$pid --softwareVersion=$sv)
60-
check_response "$result" "null"
60+
check_response "$result" "Not Found"
6161
response_does_not_contain "$result" "\"pid\": $pid"
6262
response_does_not_contain "$result" "\"vid\": $vid"
6363
echo "$result"

integration_tests/cli/model-demo.sh

+21
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,27 @@ test_divider
2828

2929
# Body
3030

31+
echo "Query non existant model"
32+
result=$(dcld query model get-model --vid=$vid --pid=$pid)
33+
check_response "$result" "Not Found"
34+
echo "$result"
35+
36+
test_divider
37+
38+
echo "Query non existant Vendor Models"
39+
result=$(dcld query model vendor-models --vid=$vid)
40+
check_response "$result" "Not Found"
41+
echo "$result"
42+
43+
test_divider
44+
45+
echo "Request all models must be empty"
46+
result=$(dcld query model all-models)
47+
check_response "$result" "\[\]"
48+
echo "$result"
49+
50+
test_divider
51+
3152
productLabel="Device #1"
3253
echo "Add Model with VID: $vid PID: $pid"
3354
result=$(echo "test1234" | dcld tx model add-model --vid=$vid --pid=$pid --deviceTypeID=1 --productName=TestProduct --productLabel="$productLabel" --partNumber=1 --commissioningCustomFlow=0 --from=$vendor_account --yes)

integration_tests/cli/modelversion-demo.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ test_divider
6060

6161
# Query non existant model version
6262
echo "Query Device Model Version with VID: $vid PID: $pid SV: 123456"
63-
result=$(dcld query model get-model-version --vid=$vid --pid=$pid --softwareVersion=123456 2>&1) || true
64-
check_response_and_report "$result" "rpc error: code = NotFound desc = not found" raw
63+
result=$(dcld query model get-model-version --vid=$vid --pid=$pid --softwareVersion=123456)
64+
check_response "$result" "Not Found"
6565

6666
test_divider
6767

integration_tests/cli/pki-demo.sh

+13-13
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_divider
4848

4949
echo "Request approved certificate must be empty"
5050
result=$(dcld query pki x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
51-
check_response "$result" "null"
51+
check_response "$result" "Not Found"
5252
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
5353
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
5454
response_does_not_contain "$result" "\"serial_number\": \"$root_cert_serial_number\""
@@ -66,7 +66,7 @@ test_divider
6666

6767
echo "Request proposed Root certificate must be empty"
6868
result=$(dcld query pki proposed-x509-root-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
69-
check_response "$result" "null"
69+
check_response "$result" "Not Found"
7070
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
7171
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
7272
response_does_not_contain "$result" "\"serial_number\": \"$root_cert_serial_number\""
@@ -85,7 +85,7 @@ test_divider
8585

8686
echo "Request revoked certificate must be empty"
8787
result=$(dcld query pki revoked-x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
88-
check_response "$result" "null"
88+
check_response "$result" "Not Found"
8989
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
9090
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
9191
echo "$result"
@@ -100,7 +100,7 @@ echo "$result"
100100

101101
echo "Request all certificates by subject must be empty"
102102
result=$(dcld query pki all-subject-x509-certs --subject="$root_cert_subject")
103-
check_response "$result" "null"
103+
check_response "$result" "Not Found"
104104
response_does_not_contain "$result" "\"$root_cert_subject\""
105105
response_does_not_contain "$result" "\"$root_cert_subject_key_id\""
106106
echo "$result"
@@ -127,7 +127,7 @@ test_divider
127127

128128
echo "Request root certificate proposed to revoke must be empty"
129129
result=$(dcld query pki proposed-x509-root-cert-to-revoke --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
130-
check_response "$result" "null"
130+
check_response "$result" "Not Found"
131131
response_does_not_contain "$result" "\"$root_cert_subject\""
132132
response_does_not_contain "$result" "\"$root_cert_subject_key_id\""
133133
echo "$result"
@@ -145,7 +145,7 @@ test_divider
145145

146146
echo "Request all child certificates must be empty"
147147
result=$(dcld query pki all-child-x509-certs --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
148-
check_response "$result" "null"
148+
check_response "$result" "Not Found"
149149
response_does_not_contain "$result" "\"$root_cert_subject\""
150150
response_does_not_contain "$result" "\"$root_cert_subject_key_id\""
151151
echo "$result"
@@ -195,7 +195,7 @@ test_divider
195195

196196
echo "Approved certificate must be empty"
197197
result=$(dcld query pki x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
198-
check_response "$result" "null"
198+
check_response "$result" "Not Found"
199199
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
200200
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
201201
response_does_not_contain "$result" "\"serial_number\": \"$root_cert_serial_number\""
@@ -547,7 +547,7 @@ test_divider
547547

548548
echo "Request all child certificates for leaf"
549549
result=$(dcld query pki all-child-x509-certs --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id")
550-
check_response "$result" "null"
550+
check_response "$result" "Not Found"
551551
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
552552
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
553553
response_does_not_contain "$result" "\"subject\": \"$intermediate_cert_subject\""
@@ -675,7 +675,7 @@ test_divider
675675

676676
echo "Approved Intermediate certificate must be empty"
677677
result=$(dcld query pki x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id")
678-
check_response "$result" "null"
678+
check_response "$result" "Not Found"
679679
response_does_not_contain "$result" "\"subject\": \"$intermediate_cert_subject\""
680680
response_does_not_contain "$result" "\"subject_key_id\": \"$intermediate_cert_subject_key_id\""
681681
response_does_not_contain "$result" "\"serial_number\": \"$intermediate_cert_serial_number\""
@@ -685,7 +685,7 @@ test_divider
685685

686686
echo "Approved Leaf certificate must be empty"
687687
result=$(dcld query pki x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id")
688-
check_response "$result" "null"
688+
check_response "$result" "Not Found"
689689
response_does_not_contain "$result" "\"subject\": \"$leaf_cert_subject\""
690690
response_does_not_contain "$result" "\"subject_key_id\": \"$leaf_cert_subject_key_id\""
691691
response_does_not_contain "$result" "\"serial_number\": \"$leaf_cert_serial_number\""
@@ -878,7 +878,7 @@ test_divider
878878

879879
echo "Approved Intermediate certificate must be empty"
880880
result=$(dcld query pki x509-cert --subject="$intermediate_cert_subject" --subject-key-id="$intermediate_cert_subject_key_id")
881-
check_response "$result" "null"
881+
check_response "$result" "Not Found"
882882
response_does_not_contain "$result" "\"subject\": \"$intermediate_cert_subject\""
883883
response_does_not_contain "$result" "\"subject_key_id\": \"$intermediate_cert_subject_key_id\""
884884
response_does_not_contain "$result" "\"serial_number\": \"$intermediate_cert_serial_number\""
@@ -888,7 +888,7 @@ test_divider
888888

889889
echo "Approved Leaf certificate must be empty"
890890
result=$(dcld query pki x509-cert --subject="$leaf_cert_subject" --subject-key-id="$leaf_cert_subject_key_id")
891-
check_response "$result" "null"
891+
check_response "$result" "Not Found"
892892
response_does_not_contain "$result" "\"subject\": \"$leaf_cert_subject\""
893893
response_does_not_contain "$result" "\"subject_key_id\": \"$leaf_cert_subject_key_id\""
894894
response_does_not_contain "$result" "\"serial_number\": \"$leaf_cert_serial_number\""
@@ -898,7 +898,7 @@ test_divider
898898

899899
echo "Approved Root certificate must be empty"
900900
result=$(dcld query pki x509-cert --subject="$root_cert_subject" --subject-key-id="$root_cert_subject_key_id")
901-
check_response "$result" "null"
901+
check_response "$result" "Not Found"
902902
response_does_not_contain "$result" "\"subject\": \"$root_cert_subject\""
903903
response_does_not_contain "$result" "\"subject_key_id\": \"$root_cert_subject_key_id\""
904904
response_does_not_contain "$result" "\"serial_number\": \"$root_cert_serial_number\""

0 commit comments

Comments
 (0)