From e993acf3af2d00c8329d3993e2a2b402acdedff6 Mon Sep 17 00:00:00 2001 From: Jon Michael Aanes Date: Fri, 19 Jul 2024 00:53:14 +0200 Subject: [PATCH] Test partisia blockchain --- fin_depo/defi_partisia_blockchain.py | 2 +- test/test_nordnet.py | 4 ++-- test/test_partisia_blockchain.py | 23 +++++++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 test/test_partisia_blockchain.py diff --git a/fin_depo/defi_partisia_blockchain.py b/fin_depo/defi_partisia_blockchain.py index 337d904..7a85d6f 100644 --- a/fin_depo/defi_partisia_blockchain.py +++ b/fin_depo/defi_partisia_blockchain.py @@ -166,7 +166,7 @@ class PartisiaBlockchainAccountDepoFetcher(DepoFetcher): {fin_defs.MPC: balances.mpc}, ) depo_byoc = DepoSingle( - 'BYOC', + 'Bring Your Own Coin', balances.update_time, {BYOC_ASSETS[k]: v for k, v in balances.byoc.items()}, ) diff --git a/test/test_nordnet.py b/test/test_nordnet.py index 7999dcb..55c27dc 100644 --- a/test/test_nordnet.py +++ b/test/test_nordnet.py @@ -14,11 +14,11 @@ needs_secrets = pytest.mark.skipif( @needs_secrets def test_get_depo(): session = requests.Session() - nordnet = investbank_nordnet.NordnetDepoFetcher( + fetcher = investbank_nordnet.NordnetDepoFetcher( session, secrets.NORDNET_USERNAME, secrets.NORDNET_PASSWORD, ) - depo = nordnet.get_depo() + depo = fetcher.get_depo() assert depo is not None diff --git a/test/test_partisia_blockchain.py b/test/test_partisia_blockchain.py new file mode 100644 index 0000000..eaedd6c --- /dev/null +++ b/test/test_partisia_blockchain.py @@ -0,0 +1,23 @@ +import fin_defs +import requests + +from fin_depo import defi_partisia_blockchain + + +def test_get_depo(): + session = requests.Session() + fetcher = defi_partisia_blockchain.PartisiaBlockchainAccountDepoFetcher( + session, + '00f3a778fbcf663e4f0d47b41aa4ec51e0f9d39d60', + ) + + depo = fetcher.get_depo() + assert depo is not None + assert depo.name == 'Partisia Blockchain' + assert depo.updated_time is not None + assert depo.nested[0].name == 'Native' + assert depo.nested[0].updated_time == depo.updated_time + assert depo.nested[1].name == 'Bring Your Own Coin' + assert depo.nested[1].updated_time == depo.updated_time + + assert depo.get_amount_of_asset(fin_defs.MPC)