datahub/metadata-ingestion/tests/unit/test_ldap_source.py
Aseem Bansal 61a95f41ae
chore: fix lint and remove incorrect integration mark from unit tests (#4621)
* chore: fix lint and remove incorrect integration mark from unit tests

* add to test requirements

* revert athena source tests
2022-04-08 17:18:48 +02:00

45 lines
924 B
Python

import pytest
from datahub.ingestion.source.ldap import parse_from_attrs, strip_ldap_info
def test_strip_ldap_info():
assert (
strip_ldap_info(b"uid=firstname.surname,ou=People,dc=internal,dc=machines")
== "firstname.surname"
)
@pytest.mark.parametrize(
"input, expected",
[
(
{
"admins": [
b"uid=A.B,ou=People,dc=internal,dc=machines",
b"uid=C.D,ou=People,dc=internal,dc=machines",
]
},
["urn:li:corpuser:A.B", "urn:li:corpuser:C.D"],
),
(
{
"not_admins": [
b"doesntmatter",
]
},
[],
),
],
)
def test_parse_from_attrs(input, expected):
assert (
parse_from_attrs(
input,
"admins",
)
== expected
)