forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_decorator.py
More file actions
32 lines (29 loc) · 771 Bytes
/
test_decorator.py
File metadata and controls
32 lines (29 loc) · 771 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import assertpy
import pytest
@pytest.mark.parametrize(
"username, can_read, can_write",
[
(None, False, False),
("r", True, False),
("w", False, True),
("rw", True, True),
],
)
def test_access_SecuredFeatureView(
security_manager, feature_views, users, username, can_read, can_write
):
sm = security_manager
fv = feature_views[0]
user = users.get(username)
sm.set_current_user(user)
if can_read:
fv.read_protected()
else:
with pytest.raises(PermissionError):
fv.read_protected()
if can_write:
fv.write_protected()
else:
with pytest.raises(PermissionError):
fv.write_protected()
assertpy.assert_that(fv.unprotected()).is_true()