From ab8505d1f6ecfd4ec5fd14affc5deebf52466951 Mon Sep 17 00:00:00 2001 From: Rigel Rozanski Date: Wed, 30 Aug 2017 19:54:55 -0400 Subject: [PATCH] init options tests --- tests/cli/init-server.sh | 52 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 22 deletions(-) mode change 100644 => 100755 tests/cli/init-server.sh diff --git a/tests/cli/init-server.sh b/tests/cli/init-server.sh old mode 100644 new mode 100755 index 7d2cce7d4..4572e0ac8 --- a/tests/cli/init-server.sh +++ b/tests/cli/init-server.sh @@ -1,23 +1,31 @@ -" Press ? for help +#!/bin/bash -.. (up a dir) -/ -▸ Applications/ -▸ bin/ -▸ cores/ -▸ dev/ -▸ etc/ -> /private/etc/ -▸ home/ -▸ Library/ -▸ net/ -▸ Network/ -▸ opt/ -▸ private/ -▸ sbin/ -▸ System/ -▸ tmp/ -> /private/tmp/ -▸ Users/ -▸ usr/ -▸ var/ -> /private/var/ -▸ Volumes/ - installer.failurerequests [RO] +CLIENT_EXE=basecli +SERVER_EXE=basecoin + +test01initOption() { + BASE=~/.bc_init_test + rm -rf "$BASE" + mkdir -p "$BASE" + + SERVER="${BASE}/server" + GENESIS_FILE=${SERVER}/genesis.json + HEX="deadbeef1234deadbeef1234deadbeef1234aaaa" + + ${SERVER_EXE} init ${HEX} --home="$SERVER" --option=app1/key1/val1 --option=app2/key2/val2 >/dev/null + if ! assertTrue "line=${LINENO}" $?; then return 1; fi + + OPTION1KEY=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[2]') + OPTION1VAL=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[3]') + OPTION2KEY=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[4]') + OPTION2VAL=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[5]') + + assertEquals "line=${LINENO}" '"app1/key1"' $OPTION1KEY + assertEquals "line=${LINENO}" '"val1"' $OPTION1VAL + assertEquals "line=${LINENO}" '"app2/key2"' $OPTION2KEY + assertEquals "line=${LINENO}" '"val2"' $OPTION2VAL +} + +# load and run these tests with shunit2! +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" #get this files directory +. $DIR/shunit2