From 1903d5503827f17d220f5b6cb35ac0c6da0d4652 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Sat, 20 Jul 2024 20:19:52 +0200 Subject: [PATCH] Added kraken and kucoin tests --- test/secrets.py | 14 ++++++++++++++ test/test_kraken.py | 22 ++++++++++++++++++++++ test/test_kucoin.py | 23 +++++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 test/test_kraken.py create mode 100644 test/test_kucoin.py diff --git a/test/secrets.py b/test/secrets.py index d6b6dea..73f2d90 100644 --- a/test/secrets.py +++ b/test/secrets.py @@ -1,6 +1,20 @@ +"""Secret loading for tests. + +Add these secrets to an [appropriate secret loader +location](https://gitfub.space/Jmaa/secret_loader). Missing some secrets will +result in skipped tests. +""" + from secret_loader import SecretLoader load_secret = SecretLoader().load NORDNET_USERNAME = load_secret('NORDNET_USERNAME') NORDNET_PASSWORD = load_secret('NORDNET_PASSWORD') + +KRAKEN_KEY = load_secret('KRAKEN_KEY') +KRAKEN_SECRET = load_secret('KRAKEN_SECRET') + +KUCOIN_KEY = load_secret('KUCOIN_KEY') +KUCOIN_SECRET = load_secret('KUCOIN_SECRET') +KUCOIN_PASS = load_secret('KUCOIN_PASS') diff --git a/test/test_kraken.py b/test/test_kraken.py new file mode 100644 index 0000000..eda798b --- /dev/null +++ b/test/test_kraken.py @@ -0,0 +1,22 @@ +import pytest +import requests + +from fin_depo import data, defi_kraken + +from . import secrets + +needs_secrets = pytest.mark.skipif( + not secrets.KRAKEN_KEY, + reason='Secret kraken_USERNAME required', +) + +@needs_secrets +def test_get_depo(): + session = requests.Session() + fetcher = defi_kraken.KrakenDepoFetcher( + secrets.KRAKEN_KEY, + secrets.KRAKEN_SECRET, + ) + + depo = fetcher.get_depo() + assert depo is not None diff --git a/test/test_kucoin.py b/test/test_kucoin.py new file mode 100644 index 0000000..25b1e2e --- /dev/null +++ b/test/test_kucoin.py @@ -0,0 +1,23 @@ +import pytest +import requests + +from fin_depo import data, defi_kucoin + +from . import secrets + +needs_secrets = pytest.mark.skipif( + not secrets.KUCOIN_KEY, + reason='Secret kucoin_USERNAME required', +) + +@needs_secrets +def test_get_depo(): + session = requests.Session() + fetcher = defi_kucoin.KucoinDepoFetcher( + secrets.KUCOIN_KEY, + secrets.KUCOIN_SECRET, + secrets.KUCOIN_PASS, + ) + + depo = fetcher.get_depo() + assert depo is not None