@@ -319,48 +319,21 @@ mod tests {
319319
320320 #[ test]
321321 fn test_path_item_set_operation ( ) {
322- let mut path_item = PathItem {
323- get : None ,
324- post : None ,
325- put : None ,
326- patch : None ,
327- delete : None ,
328- head : None ,
329- options : None ,
330- trace : None ,
331- parameters : None ,
332- summary : None ,
333- description : None ,
334- } ;
335-
336- let operation = Operation {
337- operation_id : Some ( "test_operation" . to_string ( ) ) ,
338- tags : None ,
339- summary : None ,
340- description : None ,
341- parameters : None ,
342- request_body : None ,
343- responses : BTreeMap :: new ( ) ,
344- security : None ,
345- } ;
322+ let mut path_item = PathItem { get : None , post : None , put : None , patch : None , delete : None , head : None , options : None , trace : None , parameters : None , summary : None , description : None } ;
323+
324+ let operation = Operation { operation_id : Some ( "test_operation" . to_string ( ) ) , tags : None , summary : None , description : None , parameters : None , request_body : None , responses : BTreeMap :: new ( ) , security : None } ;
346325
347326 // Test setting GET operation
348327 path_item. set_operation ( HttpMethod :: Get , operation. clone ( ) ) ;
349328 assert ! ( path_item. get. is_some( ) ) ;
350- assert_eq ! (
351- path_item. get. as_ref( ) . unwrap( ) . operation_id,
352- Some ( "test_operation" . to_string( ) )
353- ) ;
329+ assert_eq ! ( path_item. get. as_ref( ) . unwrap( ) . operation_id, Some ( "test_operation" . to_string( ) ) ) ;
354330
355331 // Test setting POST operation
356332 let mut operation_post = operation. clone ( ) ;
357333 operation_post. operation_id = Some ( "post_operation" . to_string ( ) ) ;
358334 path_item. set_operation ( HttpMethod :: Post , operation_post) ;
359335 assert ! ( path_item. post. is_some( ) ) ;
360- assert_eq ! (
361- path_item. post. as_ref( ) . unwrap( ) . operation_id,
362- Some ( "post_operation" . to_string( ) )
363- ) ;
336+ assert_eq ! ( path_item. post. as_ref( ) . unwrap( ) . operation_id, Some ( "post_operation" . to_string( ) ) ) ;
364337
365338 // Test setting PUT operation
366339 let mut operation_put = operation. clone ( ) ;
@@ -401,30 +374,9 @@ mod tests {
401374
402375 #[ test]
403376 fn test_path_item_get_operation ( ) {
404- let mut path_item = PathItem {
405- get : None ,
406- post : None ,
407- put : None ,
408- patch : None ,
409- delete : None ,
410- head : None ,
411- options : None ,
412- trace : None ,
413- parameters : None ,
414- summary : None ,
415- description : None ,
416- } ;
417-
418- let operation = Operation {
419- operation_id : Some ( "test_operation" . to_string ( ) ) ,
420- tags : None ,
421- summary : None ,
422- description : None ,
423- parameters : None ,
424- request_body : None ,
425- responses : BTreeMap :: new ( ) ,
426- security : None ,
427- } ;
377+ let mut path_item = PathItem { get : None , post : None , put : None , patch : None , delete : None , head : None , options : None , trace : None , parameters : None , summary : None , description : None } ;
378+
379+ let operation = Operation { operation_id : Some ( "test_operation" . to_string ( ) ) , tags : None , summary : None , description : None , parameters : None , request_body : None , responses : BTreeMap :: new ( ) , security : None } ;
428380
429381 // Initially, all operations should be None
430382 assert ! ( path_item. get_operation( & HttpMethod :: Get ) . is_none( ) ) ;
@@ -434,21 +386,15 @@ mod tests {
434386 path_item. set_operation ( HttpMethod :: Get , operation. clone ( ) ) ;
435387 let retrieved = path_item. get_operation ( & HttpMethod :: Get ) ;
436388 assert ! ( retrieved. is_some( ) ) ;
437- assert_eq ! (
438- retrieved. unwrap( ) . operation_id,
439- Some ( "test_operation" . to_string( ) )
440- ) ;
389+ assert_eq ! ( retrieved. unwrap( ) . operation_id, Some ( "test_operation" . to_string( ) ) ) ;
441390
442391 // Set POST operation
443392 let mut operation_post = operation. clone ( ) ;
444393 operation_post. operation_id = Some ( "post_operation" . to_string ( ) ) ;
445394 path_item. set_operation ( HttpMethod :: Post , operation_post) ;
446395 let retrieved = path_item. get_operation ( & HttpMethod :: Post ) ;
447396 assert ! ( retrieved. is_some( ) ) ;
448- assert_eq ! (
449- retrieved. unwrap( ) . operation_id,
450- Some ( "post_operation" . to_string( ) )
451- ) ;
397+ assert_eq ! ( retrieved. unwrap( ) . operation_id, Some ( "post_operation" . to_string( ) ) ) ;
452398
453399 // Test all methods
454400 path_item. set_operation ( HttpMethod :: Put , operation. clone ( ) ) ;
@@ -472,55 +418,19 @@ mod tests {
472418
473419 #[ test]
474420 fn test_path_item_set_operation_overwrites ( ) {
475- let mut path_item = PathItem {
476- get : None ,
477- post : None ,
478- put : None ,
479- patch : None ,
480- delete : None ,
481- head : None ,
482- options : None ,
483- trace : None ,
484- parameters : None ,
485- summary : None ,
486- description : None ,
487- } ;
488-
489- let operation1 = Operation {
490- operation_id : Some ( "first" . to_string ( ) ) ,
491- tags : None ,
492- summary : None ,
493- description : None ,
494- parameters : None ,
495- request_body : None ,
496- responses : BTreeMap :: new ( ) ,
497- security : None ,
498- } ;
499-
500- let operation2 = Operation {
501- operation_id : Some ( "second" . to_string ( ) ) ,
502- tags : None ,
503- summary : None ,
504- description : None ,
505- parameters : None ,
506- request_body : None ,
507- responses : BTreeMap :: new ( ) ,
508- security : None ,
509- } ;
421+ let mut path_item = PathItem { get : None , post : None , put : None , patch : None , delete : None , head : None , options : None , trace : None , parameters : None , summary : None , description : None } ;
422+
423+ let operation1 = Operation { operation_id : Some ( "first" . to_string ( ) ) , tags : None , summary : None , description : None , parameters : None , request_body : None , responses : BTreeMap :: new ( ) , security : None } ;
424+
425+ let operation2 = Operation { operation_id : Some ( "second" . to_string ( ) ) , tags : None , summary : None , description : None , parameters : None , request_body : None , responses : BTreeMap :: new ( ) , security : None } ;
510426
511427 // Set first operation
512428 path_item. set_operation ( HttpMethod :: Get , operation1) ;
513- assert_eq ! (
514- path_item. get. as_ref( ) . unwrap( ) . operation_id,
515- Some ( "first" . to_string( ) )
516- ) ;
429+ assert_eq ! ( path_item. get. as_ref( ) . unwrap( ) . operation_id, Some ( "first" . to_string( ) ) ) ;
517430
518431 // Overwrite with second operation
519432 path_item. set_operation ( HttpMethod :: Get , operation2) ;
520- assert_eq ! (
521- path_item. get. as_ref( ) . unwrap( ) . operation_id,
522- Some ( "second" . to_string( ) )
523- ) ;
433+ assert_eq ! ( path_item. get. as_ref( ) . unwrap( ) . operation_id, Some ( "second" . to_string( ) ) ) ;
524434 }
525435
526436 #[ test]
0 commit comments