1
0

Compare commits

..

No commits in common. "a816adacbb93e9651230f4ac2795d3d280aee2ba" and "d2cdef2bfa52dcf378321e307460b282f9784d9a" have entirely different histories.

3 changed files with 5 additions and 29 deletions

View File

@ -1,18 +0,0 @@
import logging
logger = logging.getLogger(__name__)
def load_secret(env_key: str) -> str:
filepath = f'./secrets/{env_key.lower()}'
try:
with open(filepath) as f:
return f.read().strip()
logger.info('Loaded secret: %s', env_key)
except Exception:
logger.exception("Could not load %s file '%s'", env_key, filepath)
return None
NORDNET_USERNAME = load_secret('NORDNET_USERNAME')
NORDNET_PASSWORD = load_secret('NORDNET_PASSWORD')

View File

@ -1,23 +1,17 @@
import pytest
import requests import requests
from fin_depo import investbank_nordnet from fin_depo import investbank_nordnet
from . import secrets SECRET_USERNAME = None
SECRET_PASSWORD = None
needs_secrets = pytest.mark.skipif(
not secrets.NORDNET_USERNAME,
reason='Secret NORDNET_USERNAME required',
)
@needs_secrets
def test_get_depo(): def test_get_depo():
session = requests.Session() session = requests.Session()
nordnet = investbank_nordnet.NordnetDepoFetcher( nordnet = investbank_nordnet.NordnetDepoFetcher(
session, session,
secrets.NORDNET_USERNAME, SECRET_USERNAME,
secrets.NORDNET_PASSWORD, SECRET_PASSWORD,
) )
depo = nordnet.get_depo() depo = nordnet.get_depo()