mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-31 09:06:35 +00:00
refactor: restructure as installable PyPI package
- Rename app/ → fragmentapi/ for proper package naming - Add FragmentClient class with gift_premium, gift_stars, topup_ton methods - Restructure core/ → types/ (exceptions, results, constants) - Merge utils/hash.py into utils/client.py - Replace _version.py with importlib.metadata - Add input validation with min/max bounds - Add unit tests: decode, client init/cookies - Rename 002_test_hash → 003_test_hash - Clean up pyproject.toml: pin deps, production classifiers
This commit is contained in:
+10
-6
@@ -1,13 +1,17 @@
|
||||
import pytest
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from app.core.cookies import load_cookies
|
||||
from app.core.exceptions import CookiesError
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cookies():
|
||||
"""Load Fragment cookies; skip the test if they are unavailable."""
|
||||
"""Load Fragment cookies from cookies.json; skip the test if unavailable."""
|
||||
cookies_path = Path(__file__).resolve().parents[1] / "cookies.json"
|
||||
if not cookies_path.exists():
|
||||
pytest.skip("cookies.json not found")
|
||||
try:
|
||||
return load_cookies()
|
||||
except CookiesError as exc:
|
||||
with cookies_path.open("r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception as exc:
|
||||
pytest.skip(f"Cookies unavailable — {exc}")
|
||||
|
||||
Reference in New Issue
Block a user