33 lines
709 B
Python
33 lines
709 B
Python
import pytest
|
|
import requests
|
|
|
|
from fin_depo import data, investbank_nordnet
|
|
|
|
from . import secrets
|
|
|
|
needs_secrets = pytest.mark.skipif(
|
|
not secrets.NORDNET_USERNAME,
|
|
reason='Secret NORDNET_USERNAME required',
|
|
)
|
|
|
|
|
|
def print_pretty(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 = investbank_nordnet.NordnetDepoFetcher(
|
|
session,
|
|
secrets.NORDNET_USERNAME,
|
|
secrets.NORDNET_PASSWORD,
|
|
)
|
|
|
|
depo = fetcher.get_depo()
|
|
print_pretty(depo)
|
|
assert depo is not None
|