delta-barth-py/tests/api/conftest.py

33 lines
724 B
Python

from unittest.mock import patch
import pytest
from delta_barth.api import common
from delta_barth.constants import HTTP_BASE_CONTENT_HEADERS
@pytest.fixture(scope="function")
def session(credentials, api_base_url) -> common.Session:
session = common.Session(HTTP_BASE_CONTENT_HEADERS)
session.set_base_url(api_base_url)
session.set_credentials(
username=credentials["user"],
password=credentials["pwd"],
database=credentials["db"],
mandant=credentials["mandant"],
)
return session
@pytest.fixture
def mock_put():
with patch("requests.put") as mock:
yield mock
@pytest.fixture
def mock_get():
with patch("requests.get") as mock:
yield mock