changeset 29687:521c8602e897

test: wallet utility python test
author Braydon Fuller <braydon@bitpay.com>
date Mon, 18 Jul 2016 18:03:01 -0400
parents d39665a7ebb8
children c344cec39fe2
files src/Makefile.test.include src/test/wallet-utility.py
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/Makefile.test.include	Thu Jun 30 18:00:50 2016 -0400
+++ b/src/Makefile.test.include	Mon Jul 18 18:03:01 2016 -0400
@@ -131,6 +131,8 @@
 check-local:
 	@echo "Running test/bitcoin-util-test.py..."
 	$(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/bitcoin-util-test.py
+	@echo "Running test/wallet-utility.py..."
+	$(AM_V_at)srcdir=$(srcdir) PYTHONPATH=$(builddir)/test $(srcdir)/test/wallet-utility.py
 	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check
 	$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C univalue check
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/wallet-utility.py	Mon Jul 18 18:03:01 2016 -0400
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+# Copyright 2014 BitPay, Inc.
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+from subprocess import check_output
+import json
+
+import os
+
+def assert_equal(thing1, thing2):
+    if thing1 != thing2:
+        raise AssertionError("%s != %s"%(str(thing1),str(thing2)))
+
+if __name__ == '__main__':
+    datadir = os.environ["srcdir"] + "/test/data"
+    command = os.environ["srcdir"] + "/wallet-utility"
+
+    output = json.loads(check_output([command, "-datadir=" + datadir]))
+
+    assert_equal(output[0], "13EngsxkRi7SJPPqCyJsKf34U8FoX9E9Av");
+    assert_equal(output[1], "1FKCLGTpPeYBUqfNxktck8k5nqxB8sjim8");
+    assert_equal(output[2], "13cdtE9tnNeXCZJ8KQ5WELgEmLSBLnr48F");
+
+
+