mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 14:24:31 +00:00
363e0719ab
- Updated version in pyproject.toml to 2026.2.3. - Refactored wallet utilities: - Moved `clean_decode` and `process_transaction` to `transaction.py`. - Created `balance.py` for balance-related functions. - Created `info.py` for wallet information retrieval. - Created `transfer.py` for sending TON and USDT transfers. - Updated tests to reflect new module structure and imports. - Added new API utility functions for handling Fragment API requests.
22 lines
766 B
Python
22 lines
766 B
Python
"""Unit tests for init payment amount parsing."""
|
|
|
|
from pyfragment.utils.parser import parse_required_payment_amount
|
|
|
|
|
|
def test_parse_required_payment_amount_ton_uses_amount() -> None:
|
|
init_response = {"amount": "0.326"}
|
|
assert parse_required_payment_amount(init_response) == 0.326
|
|
|
|
|
|
def test_parse_required_payment_amount_usdt_uses_amount() -> None:
|
|
init_response = {
|
|
"amount": "0.00075",
|
|
"content": '<span class="icon-before icon-usd">0.75</span>',
|
|
}
|
|
assert parse_required_payment_amount(init_response) == 0.00075
|
|
|
|
|
|
def test_parse_required_payment_amount_usdt_falls_back_to_amount() -> None:
|
|
init_response = {"amount": "1.25", "content": "<p>no usd icon</p>"}
|
|
assert parse_required_payment_amount(init_response) == 1.25
|