Tests/tests/fixtures/data_fixtures.py
2026-01-19 23:32:11 +04:00

24 lines
635 B
Python

import json
from pathlib import Path
import pytest
def _load_data(filename: str):
current_file = Path(__file__).resolve()
data_path = current_file.parent.parent.joinpath("data")
data_file_path = data_path.joinpath(filename)
with open(data_file_path, 'r', encoding='utf-8') as f:
data = json.load(f)
return data
@pytest.fixture(scope="session")
def api_user_data():
return _load_data('api_users.json')
@pytest.fixture(scope="session")
def api_post_data():
return _load_data('api_posts.json')
@pytest.fixture(scope="session")
def api_user_auth_data():
return _load_data('api_user_auth.json')