mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-25 06:14:29 +00:00
Add unit tests for FragmentClient methods
- Implement tests for Stars methods: purchase_stars and giveaway_stars, including validation and success scenarios. - Add tests for Premium methods: purchase_premium and giveaway_premium, covering validation and success cases. - Create tests for topup_ton functionality, validating input and mocking successful operations. - Introduce wallet tests to verify get_wallet() functionality, ensuring correct wallet info retrieval. - Add tests for FragmentClient.call() method, validating API response handling and data merging. - Implement tests for anonymous number methods, including login codes and session management. - Create recharge_ads tests for self-service Telegram Ads recharge, validating input and success scenarios. - Add username search tests for the Fragment marketplace, ensuring correct result parsing and parameter forwarding. - Implement number search tests for the Fragment marketplace, validating result parsing and parameter handling. - Create gift search tests for the Fragment gifts marketplace, ensuring correct result parsing and parameter forwarding. - Add cookie extraction tests for get_cookies_from_browser(), validating successful extraction and error handling.
This commit is contained in:
@@ -123,7 +123,7 @@ class FragmentClient:
|
||||
return f"FragmentClient(wallet_version='{self.wallet_version}', cookies={len(self.cookies)} keys)"
|
||||
|
||||
async def purchase_premium(self, username: str, months: int, show_sender: bool = True) -> PremiumResult:
|
||||
"""Purchase Telegram Premium for a user.
|
||||
"""Gift Telegram Premium to a user.
|
||||
|
||||
Args:
|
||||
username: Recipient's Telegram username (with or without ``@``).
|
||||
@@ -136,7 +136,7 @@ class FragmentClient:
|
||||
return await purchase_premium(self, username, months, show_sender)
|
||||
|
||||
async def purchase_stars(self, username: str, amount: int, show_sender: bool = True) -> StarsResult:
|
||||
"""Purchase Telegram Stars for a user.
|
||||
"""Send Telegram Stars to a user.
|
||||
|
||||
Args:
|
||||
username: Recipient's Telegram username (with or without ``@``).
|
||||
@@ -149,7 +149,7 @@ class FragmentClient:
|
||||
return await purchase_stars(self, username, amount, show_sender)
|
||||
|
||||
async def topup_ton(self, username: str, amount: int, show_sender: bool = True) -> AdsTopupResult:
|
||||
"""Topup ton to recipient's Telegram balance.
|
||||
"""Top up TON to a recipient's Telegram balance.
|
||||
|
||||
Args:
|
||||
username: Recipient's Telegram username (with or without ``@``).
|
||||
|
||||
Reference in New Issue
Block a user