1
0
fin-depo/test/test_nordnet.py
Jon Michael Aanes 677e2af74c
All checks were successful
Test Python / Test (push) Successful in 27s
Expose data in __init__
2024-07-21 11:15:13 +02:00

33 lines
722 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)
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)