1
0
fin-depo/test/test_nordnet.py
Jon Michael Aanes 7a5ebae6ff
All checks were successful
Test Python / Test (push) Successful in 27s
Code quality
2024-07-19 01:25:14 +02:00

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