forked from gooddata/gooddata-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
26 lines (21 loc) · 783 Bytes
/
conftest.py
File metadata and controls
26 lines (21 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# (C) 2024 GoodData Corporation
import os
import sys
import pytest
from env import HOST, TOKEN
from gooddata_api_client import ApiClient, Configuration
# Add the root directory to the Python path
ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(ROOT_DIR)
@pytest.fixture(scope="session", autouse=True)
def set_authorization_header():
"""
Fixture to set the Authorization header globally for all tests.
"""
configuration = Configuration(host=HOST)
configuration.access_token = TOKEN
api_client = ApiClient(configuration)
api_client.default_headers["Authorization"] = f"Bearer {TOKEN}"
yield api_client
# Cleanup after the tests, if necessary (e.g., closing client)
api_client.close()