34 lines
752 B
Python
34 lines
752 B
Python
import pytest
|
|
import requests
|
|
|
|
import fin_depo
|
|
|
|
from . import secrets
|
|
|
|
needs_secrets = pytest.mark.skipif(
|
|
not secrets.NORDNET_USERNAME,
|
|
reason='Secret NORDNET_USERNAME required',
|
|
)
|
|
|
|
|
|
def print_pretty(depo: fin_depo.data.Depo):
|
|
for asset in depo.assets():
|
|
amount = depo.get_amount_of_asset(asset)
|
|
str_asset = str(asset)
|
|
print(f'{str_asset:15} : {amount:10}')
|
|
del asset, amount
|
|
|
|
|
|
@needs_secrets
|
|
def test_get_depo():
|
|
session = requests.Session()
|
|
fetcher = fin_depo.investbank_nordnet.NordnetDepoFetcher(
|
|
session,
|
|
secrets.NORDNET_USERNAME,
|
|
secrets.NORDNET_PASSWORD,
|
|
)
|
|
|
|
depo = fetcher.get_depo()
|
|
print_pretty(depo)
|
|
assert isinstance(depo, fin_depo.data.DepoGroup)
|