mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-25 08:58:26 +00:00
feat(tests): allow use of system auth for test session (#7445)
This commit is contained in:
parent
b203dd2895
commit
cb7f1c6dc3
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user