From 9bc11d8dd9f7960ba5a0d1773a486f1301d19f87 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 25 May 2023 17:55:20 -0400 Subject: [PATCH] Add basic config checking tests --- tests/test_accounting.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test_accounting.py diff --git a/tests/test_accounting.py b/tests/test_accounting.py new file mode 100644 index 00000000..f5a3bd8d --- /dev/null +++ b/tests/test_accounting.py @@ -0,0 +1,35 @@ +''' +`piker.accounting` mgmt calculations for +- positioning +- ledger updates +- config file IO + +''' +from pathlib import Path + +from piker import config + + +def test_root_conf_networking_section( + root_conf: dict, +): + conf, path = config.load( + 'conf', + touch_if_dne=True, + ) + assert conf['network']['tsdb'] + + +def test_account_file_default_empty( + tmpconfdir: Path, +): + conf, path = config.load_account( + 'kraken', + 'paper', + ) + + # ensure the account file empty but created + # and in the correct place in the filesystem! + assert not conf + assert path.parent.is_dir() + assert path.parent.name == 'accounting'