@@ -142,6 +142,11 @@ def _test_get_historical_features(client_fs: FeatureStore):
142142
143143
144144def _test_get_entity (client_fs : FeatureStore , permissions : list [Permission ]):
145+ if _is_auth_enabled (client_fs ) and len (permissions ) == 0 :
146+ with pytest .raises (FeastPermissionError ):
147+ client_fs .get_entity ("driver" )
148+ return
149+
145150 if not _is_auth_enabled (client_fs ) or _is_permission_enabled (
146151 client_fs , permissions , read_entities_perm
147152 ):
@@ -156,6 +161,18 @@ def _test_get_entity(client_fs: FeatureStore, permissions: list[Permission]):
156161
157162
158163def _test_list_entities (client_fs : FeatureStore , permissions : list [Permission ]):
164+ if _is_auth_enabled (client_fs ) and len (permissions ) == 0 :
165+ with pytest .raises (FeastPermissionError ):
166+ client_fs .list_entities ()
167+ return
168+
169+ if _is_auth_enabled (client_fs ) and _permissions_exist_in_permission_list (
170+ [invalid_list_entities_perm ], permissions
171+ ):
172+ with pytest .raises (FeastPermissionError ):
173+ client_fs .list_entities ()
174+ return
175+
159176 entities = client_fs .list_entities ()
160177
161178 if not _is_auth_enabled (client_fs ) or _is_permission_enabled (
@@ -183,6 +200,10 @@ def _test_list_permissions(
183200 with pytest .raises (Exception ):
184201 client_fs .list_permissions ()
185202 return []
203+ elif _is_auth_enabled (client_fs ) and len (applied_permissions ) == 0 :
204+ with pytest .raises (FeastPermissionError ):
205+ client_fs .list_permissions ()
206+ return []
186207 else :
187208 permissions = client_fs .list_permissions ()
188209
@@ -229,6 +250,11 @@ def _is_auth_enabled(client_fs: FeatureStore) -> bool:
229250
230251
231252def _test_get_fv (client_fs : FeatureStore , permissions : list [Permission ]):
253+ if _is_auth_enabled (client_fs ) and len (permissions ) == 0 :
254+ with pytest .raises (FeastPermissionError ):
255+ client_fs .get_feature_view ("driver_hourly_stats" )
256+ return
257+
232258 if not _is_auth_enabled (client_fs ) or _is_permission_enabled (
233259 client_fs , permissions , read_fv_perm
234260 ):
@@ -249,6 +275,10 @@ def _test_list_fvs(client_fs: FeatureStore, permissions: list[Permission]):
249275 with pytest .raises (Exception ):
250276 client_fs .list_feature_views ()
251277 return []
278+ elif _is_auth_enabled (client_fs ) and len (permissions ) == 0 :
279+ with pytest .raises (FeastPermissionError ):
280+ client_fs .list_feature_views ()
281+ return []
252282 else :
253283 fvs = client_fs .list_feature_views ()
254284 for fv in fvs :
0 commit comments