Skip to content

Commit

Permalink
BI-4885: add more RLS unit tests (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCPN authored Dec 5, 2023
1 parent 94036b2 commit 9b6efd0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/dl_api_lib/dl_api_lib_tests/unit/test_rls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
RLS_CONFIG_CASES,
config_to_comparable,
)
from dl_constants.enums import RLSSubjectType
from dl_core.rls import RLSSubject


def test_group_names_by_account_type():
account_types = FieldRLSSerializer._group_names_by_account_type(["@sa:123", "user1", "user2", "@sa:456"])
assert account_types == FieldRLSSerializer.AccountGroups(["user1", "user2"], ["@sa:123", "@sa:456"])


def test_parse_sa_str():
parsed = FieldRLSSerializer._parse_sa_account_str("@sa:123")
assert parsed == RLSSubject(subject_type=RLSSubjectType.user, subject_id="123", subject_name="@sa:123")


@pytest.mark.parametrize("case", RLS_CONFIG_CASES, ids=[c["name"] for c in RLS_CONFIG_CASES])
Expand Down

0 comments on commit 9b6efd0

Please sign in to comment.