File tree 2 files changed +16
-4
lines changed 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -643,6 +643,7 @@ pub(crate) mod tests {
643
643
\" is_root_device\" : true, \
644
644
\" partuuid\" : \" string\" , \
645
645
\" is_read_only\" : true, \
646
+ \" cache_type\" : \" Unsafe\" , \
646
647
\" rate_limiter\" : { \
647
648
\" bandwidth\" : { \
648
649
\" size\" : 0, \
Original file line number Diff line number Diff line change @@ -216,20 +216,33 @@ mod tests {
216
216
assert ! ( parse_put_drive( & Body :: new( "invalid_payload" ) , None ) . is_err( ) ) ;
217
217
assert ! ( parse_put_drive( & Body :: new( "invalid_payload" ) , Some ( & "id" ) ) . is_err( ) ) ;
218
218
219
- // PATCH with invalid fields.
219
+ // PUT with invalid fields.
220
220
let body = r#"{
221
221
"drive_id": "bar",
222
222
"is_read_only": false
223
223
}"# ;
224
224
assert ! ( parse_put_drive( & Body :: new( body) , Some ( & "2" ) ) . is_err( ) ) ;
225
225
226
- // PATCH with invalid types on fields. Adding a drive_id as number instead of string.
226
+ // PUT with missing all optional fields.
227
+ let body = r#"{
228
+ "drive_id": "1000",
229
+ "path_on_host": "dummy",
230
+ "is_root_device": true,
231
+ "is_read_only": true
232
+ }"# ;
233
+ assert ! ( parse_put_drive( & Body :: new( body) , Some ( & "1000" ) ) . is_ok( ) ) ;
234
+
235
+ // PUT with invalid types on fields. Adding a drive_id as number instead of string.
236
+ assert ! ( parse_put_drive( & Body :: new( body) , Some ( & "foo" ) ) . is_err( ) ) ;
237
+
238
+ // PUT with the complete configuration.
227
239
let body = r#"{
228
240
"drive_id": "1000",
229
241
"path_on_host": "dummy",
230
242
"is_root_device": true,
231
243
"partuuid": "string",
232
244
"is_read_only": true,
245
+ "cache_type": "Unsafe",
233
246
"rate_limiter": {
234
247
"bandwidth": {
235
248
"size": 0,
@@ -244,7 +257,5 @@ mod tests {
244
257
}
245
258
}"# ;
246
259
assert ! ( parse_put_drive( & Body :: new( body) , Some ( & "1000" ) ) . is_ok( ) ) ;
247
-
248
- assert ! ( parse_put_drive( & Body :: new( body) , Some ( & "foo" ) ) . is_err( ) ) ;
249
260
}
250
261
}
You can’t perform that action at this time.
0 commit comments