2021-02-18 20:05:39 -08:00
|
|
|
import mce_helpers
|
2021-04-01 12:15:05 -07:00
|
|
|
import pytest
|
2021-02-18 20:05:39 -08:00
|
|
|
|
|
|
|
from datahub.ingestion.run.pipeline import Pipeline
|
|
|
|
|
|
|
|
|
2021-04-01 12:15:05 -07:00
|
|
|
@pytest.mark.slow
|
2021-03-11 02:29:24 -05:00
|
|
|
def test_ldap_ingest(mysql, pytestconfig, tmp_path, mock_time):
|
2021-02-18 20:05:39 -08:00
|
|
|
test_resources_dir = pytestconfig.rootpath / "tests/integration/ldap"
|
|
|
|
|
|
|
|
pipeline = Pipeline.create(
|
|
|
|
{
|
2021-02-23 15:55:31 -08:00
|
|
|
"run_id": "ldap-test",
|
2021-02-18 20:05:39 -08:00
|
|
|
"source": {
|
|
|
|
"type": "ldap",
|
|
|
|
"config": {
|
|
|
|
"ldap_server": "ldap://localhost",
|
|
|
|
"ldap_user": "cn=admin,dc=example,dc=org",
|
|
|
|
"ldap_password": "admin",
|
|
|
|
"base_dn": "dc=example,dc=org",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"sink": {
|
|
|
|
"type": "file",
|
|
|
|
"config": {
|
|
|
|
"filename": f"{tmp_path}/ldap_mces.json",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
pipeline.run()
|
|
|
|
pipeline.raise_from_status()
|
|
|
|
|
|
|
|
output = mce_helpers.load_json_file(str(tmp_path / "ldap_mces.json"))
|
|
|
|
golden = mce_helpers.load_json_file(
|
|
|
|
str(test_resources_dir / "ldap_mce_golden.json")
|
|
|
|
)
|
|
|
|
mce_helpers.assert_mces_equal(output, golden)
|