-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import pytest | ||
from ntropy_sdk.async_.sdk import AsyncSDK | ||
from ntropy_sdk.v2.errors import NtropyValueError | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_async_pagination(async_sdk: AsyncSDK): | ||
tx_ids = set() | ||
it = (await async_sdk.transactions.list(limit=2)).auto_paginate(page_size=2) | ||
i = 0 | ||
async for tx in it: | ||
tx_ids.add(tx.id) | ||
i += 1 | ||
if i == 10: | ||
break | ||
assert len(tx_ids) == 10 | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_recurrence_groups(async_sdk: AsyncSDK): | ||
sdk = async_sdk | ||
try: | ||
await sdk.account_holders.create( | ||
id="Xksd9SWd", | ||
type="consumer", | ||
) | ||
except NtropyValueError: | ||
pass | ||
|
||
for i in range(1, 5): | ||
await sdk.transactions.create( | ||
id=f"netflix-{i}", | ||
description=f"Recurring Debit Purchase Card 1350 #{i} netflix.com Netflix.com CA", | ||
amount=17.99, | ||
currency="USD", | ||
entry_type="outgoing", | ||
date=f"2021-0{i}-01", | ||
account_holder_id="Xksd9SWd", | ||
) | ||
|
||
recurring_groups = await sdk.account_holders.recurring_groups("Xksd9SWd") | ||
|
||
assert recurring_groups.groups[0].counterparty.website == "netflix.com" | ||
assert recurring_groups.groups[0].periodicity == "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters