-
Notifications
You must be signed in to change notification settings - Fork 20
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
1 parent
916cd9b
commit 6129299
Showing
1 changed file
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import datetime | ||
from decimal import Decimal | ||
|
||
from investments.currency import Currency | ||
from investments.money import Money | ||
from investments.fees import Fee | ||
from investments.data_providers.cbr import ExchangeRatesRUB | ||
from investments.ibtax.ibtax import prepare_fees_report | ||
|
||
|
||
def test_simple_fees_verbose(): | ||
fees = [ | ||
Fee(date=datetime.datetime(2020, 1, 30, 0, 0), amount=Money(0.01, Currency.USD), description='Other Fees'), | ||
Fee(date=datetime.datetime(2020, 1, 30, 0, 0), amount=Money(-0.01, Currency.USD), description='Other Fees'), | ||
] | ||
cbr_client = ExchangeRatesRUB() | ||
res: dict = prepare_fees_report(fees, cbr_client, True).to_dict() | ||
assert res['rate'] == { | ||
0: Money(62.3934, Currency.RUB), | ||
1: Money(62.3934, Currency.RUB) | ||
} | ||
assert res['amount_rub'] == { | ||
0: Money(0.623934, Currency.RUB), | ||
1: Money(-0.623934, Currency.RUB) | ||
} | ||
|
||
|
||
def test_simple_fees_no_verbose(): | ||
fees = [ | ||
Fee(date=datetime.datetime(2020, 1, 30, 0, 0), amount=Money(0.01, Currency.USD), description='Other Fees'), | ||
Fee(date=datetime.datetime(2020, 1, 30, 0, 0), amount=Money(-0.01, Currency.USD), description='Other Fees'), | ||
] | ||
cbr_client = ExchangeRatesRUB() | ||
res: dict = prepare_fees_report(fees, cbr_client, False).to_dict() | ||
assert res['rate'] == {} | ||
assert res['amount_rub'] == {} | ||
|