@@ -145,8 +145,7 @@ def test_feature_services_via_rest(fastapi_test_app):
145145
146146def test_data_sources_via_rest (fastapi_test_app ):
147147 response = fastapi_test_app .get ("/data_sources?project=demo_project" )
148- assert response .status_code == 200
149- assert "data_sources" in response .json ()
148+ assert "dataSources" in response .json ()
150149 response = fastapi_test_app .get (
151150 "/data_sources/user_profile_source?project=demo_project"
152151 )
@@ -650,9 +649,9 @@ def test_data_sources_pagination_via_rest(fastapi_test_app_with_multiple_objects
650649 response = client .get ("/data_sources?project=demo_project&page=1&limit=2" )
651650 assert response .status_code == 200
652651 data = response .json ()
653- assert "data_sources " in data
652+ assert "dataSources " in data
654653 assert "pagination" in data
655- assert len (data ["data_sources " ]) == 2
654+ assert len (data ["dataSources " ]) == 2
656655 assert data ["pagination" ]["page" ] == 1
657656 assert data ["pagination" ]["limit" ] == 2
658657 assert data ["pagination" ]["totalCount" ] == 3
@@ -669,7 +668,7 @@ def test_data_sources_sorting_via_rest(fastapi_test_app_with_multiple_objects):
669668 )
670669 assert response .status_code == 200
671670 data = response .json ()
672- ds_names = [ds ["name" ] for ds in data ["data_sources " ]]
671+ ds_names = [ds ["name" ] for ds in data ["dataSources " ]]
673672 assert ds_names == sorted (ds_names )
674673
675674
@@ -1064,3 +1063,70 @@ def test_lineage_complete_all_via_rest(fastapi_test_app):
10641063 assert "dataSources" in project_data ["objects" ]
10651064 assert "featureViews" in project_data ["objects" ]
10661065 assert "featureServices" in project_data ["objects" ]
1066+
1067+
1068+ def test_invalid_project_name_with_relationships_via_rest (fastapi_test_app ):
1069+ """Test REST API response with invalid project name using include_relationships=true.
1070+ The API should not throw 500 or any other error when an invalid project name is provided
1071+ with include_relationships=true parameter.
1072+ """
1073+ response = fastapi_test_app .get (
1074+ "/entities?project=invalid_project_name&include_relationships=true"
1075+ )
1076+ assert response .status_code == 200
1077+ data = response .json ()
1078+ assert "entities" in data
1079+ assert isinstance (data ["entities" ], list )
1080+ assert len (data ["entities" ]) == 0
1081+ assert "relationships" in data
1082+ assert isinstance (data ["relationships" ], dict )
1083+ assert len (data ["relationships" ]) == 0
1084+
1085+ response = fastapi_test_app .get (
1086+ "/feature_views?project=invalid_project_name&include_relationships=true"
1087+ )
1088+ assert response .status_code == 200
1089+ data = response .json ()
1090+ assert "featureViews" in data
1091+ assert isinstance (data ["featureViews" ], list )
1092+ assert len (data ["featureViews" ]) == 0
1093+ assert "relationships" in data
1094+ assert isinstance (data ["relationships" ], dict )
1095+ assert len (data ["relationships" ]) == 0
1096+
1097+ response = fastapi_test_app .get (
1098+ "/data_sources?project=invalid_project_name&include_relationships=true"
1099+ )
1100+ # Should return 200 with empty results, not 500 or other errors
1101+ assert response .status_code == 200
1102+ data = response .json ()
1103+ assert "dataSources" in data
1104+ assert isinstance (data ["dataSources" ], list )
1105+ assert len (data ["dataSources" ]) == 0
1106+ assert "relationships" in data
1107+ assert isinstance (data ["relationships" ], dict )
1108+ assert len (data ["relationships" ]) == 0
1109+
1110+ response = fastapi_test_app .get (
1111+ "/feature_services?project=invalid_project_name&include_relationships=true"
1112+ )
1113+ assert response .status_code == 200
1114+ data = response .json ()
1115+ assert "featureServices" in data
1116+ assert isinstance (data ["featureServices" ], list )
1117+ assert len (data ["featureServices" ]) == 0
1118+ assert "relationships" in data
1119+ assert isinstance (data ["relationships" ], dict )
1120+ assert len (data ["relationships" ]) == 0
1121+
1122+ response = fastapi_test_app .get (
1123+ "/features?project=invalid_project_name&include_relationships=true"
1124+ )
1125+ assert response .status_code == 200
1126+ data = response .json ()
1127+ assert "features" in data
1128+ assert isinstance (data ["features" ], list )
1129+ assert len (data ["features" ]) == 0
1130+ assert "relationships" in data
1131+ assert isinstance (data ["relationships" ], dict )
1132+ assert len (data ["relationships" ]) == 0
0 commit comments