()
| 559 | |
| 560 | #[test] |
| 561 | fn multiple_match_blocks() { |
| 562 | let input = r#" |
| 563 | match user alice |
| 564 | passwordauthentication yes |
| 565 | match group administrators |
| 566 | permitrootlogin yes |
| 567 | "#; |
| 568 | let result: Map<String, Value> = parse_text_to_map(input).unwrap(); |
| 569 | let match_array = result.get("match").unwrap().as_array().unwrap(); |
| 570 | assert_eq!(match_array.len(), 2); |
| 571 | let match_obj1 = match_array[0].as_object().unwrap(); |
| 572 | let criteria1 = match_obj1.get("criteria").unwrap().as_object().unwrap(); |
| 573 | let user_array1 = criteria1.get("user").unwrap().as_array().unwrap(); |
| 574 | assert_eq!(user_array1[0], Value::String("alice".to_string())); |
| 575 | assert_eq!(match_obj1.get("passwordauthentication").unwrap(), &Value::Bool(true)); |
| 576 | let match_obj2 = match_array[1].as_object().unwrap(); |
| 577 | let criteria2 = match_obj2.get("criteria").unwrap().as_object().unwrap(); |
| 578 | let group_array2 = criteria2.get("group").unwrap().as_array().unwrap(); |
| 579 | assert_eq!(group_array2[0], Value::String("administrators".to_string())); |
| 580 | assert_eq!(match_obj2.get("permitrootlogin").unwrap(), &Value::Bool(true)); |
| 581 | } |
| 582 | |
| 583 | #[test] |
| 584 | fn match_with_comma_separated_criteria() { |
nothing calls this directly
no test coverage detected