()
| 880 | |
| 881 | #[test] |
| 882 | fn validate_entities_detect_cycle_fails() { |
| 883 | let json_data = json!( |
| 884 | { |
| 885 | "entities": [ |
| 886 | { |
| 887 | "uid": { |
| 888 | "type": "PhotoApp::UserGroup", |
| 889 | "id": "ABCTeam" |
| 890 | }, |
| 891 | "attrs": {}, |
| 892 | "parents": [ |
| 893 | { |
| 894 | "type": "PhotoApp::UserGroup", |
| 895 | "id": "AVTeam" |
| 896 | } |
| 897 | ] |
| 898 | }, |
| 899 | { |
| 900 | "uid": { |
| 901 | "type": "PhotoApp::UserGroup", |
| 902 | "id": "AVTeam" |
| 903 | }, |
| 904 | "attrs": {}, |
| 905 | "parents": [ |
| 906 | { |
| 907 | "type": "PhotoApp::UserGroup", |
| 908 | "id": "ABCTeam" |
| 909 | } |
| 910 | ] |
| 911 | } |
| 912 | ], |
| 913 | "schema": { |
| 914 | "PhotoApp": { |
| 915 | "commonTypes": {}, |
| 916 | "entityTypes": { |
| 917 | "UserGroup": { |
| 918 | "shape": { |
| 919 | "type": "Record", |
| 920 | "attributes": {} |
| 921 | }, |
| 922 | "memberOfTypes": [ |
| 923 | "UserGroup" |
| 924 | ] |
| 925 | } |
| 926 | }, |
| 927 | "actions": {} |
| 928 | } |
| 929 | } |
| 930 | }); |
| 931 | let result = call_cedar("ValidateEntities", json_data.to_string().as_str()); |
| 932 | assert_failure(&result); |
| 933 | |
| 934 | assert!( |
| 935 | result.contains("input graph has a cycle containing vertex `PhotoApp::UserGroup"), |
| 936 | "result was `{result}`", |
| 937 | ); |
| 938 | } |
| 939 |
nothing calls this directly
no test coverage detected