feat(tests): allow use of system auth for test session (#7445)

This commit is contained in:
Aseem Bansal 2023-02-27 22:41:06 +05:30 committed by GitHub
parent b203dd2895
commit cb7f1c6dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ from joblib import Parallel, delayed
import requests_wrapper as requests
from datahub.cli import cli_utils
from datahub.cli.cli_utils import get_system_auth
from datahub.ingestion.run.pipeline import Pipeline
TIME: int = 1581407189000
@ -19,10 +20,16 @@ def get_frontend_session():
headers = {
"Content-Type": "application/json",
}
username, password = get_admin_credentials()
data = '{"username":"' + username + '", "password":"' + password + '"}'
response = session.post(f"{get_frontend_url()}/logIn", headers=headers, data=data)
response.raise_for_status()
system_auth = get_system_auth()
if system_auth is not None:
session.headers.update({"Authorization": system_auth})
else:
username, password = get_admin_credentials()
data = '{"username":"' + username + '", "password":"' + password + '"}'
response = session.post(
f"{get_frontend_url()}/logIn", headers=headers, data=data
)
response.raise_for_status()
return session