Skip to content

Commit

Permalink
Add a test for account import process substitution support
Browse files Browse the repository at this point in the history
  • Loading branch information
eval-exec committed Jan 10, 2024
1 parent ab5df1f commit 9f49c41
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/cli_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -evxo pipefail

# assert must contains one argument
if [ $# -ne 1 ]; then
echo "Usage: $0 <ckb-cli-bin>"
exit 1
fi

CKB_CLI_BIN=$1

function account_import_process_substitution {

HOME1=$(mktemp -d)
export CKB_CLI_HOME=${HOME1}
printf "abc123\nabc123" | ("${CKB_CLI_BIN}" account new)

LOCK_ARG=$("${CKB_CLI_BIN}" account list --output-format json | jq '.[0].lock_arg' | sed 's/"//g')

PRIV_PATH=$(mktemp -d)/privkey.text
printf "abc123" | ("${CKB_CLI_BIN}" account export --lock-arg ${LOCK_ARG} --extended-privkey-path ${PRIV_PATH})

HOME1=$(mktemp -d)
export CKB_CLI_HOME=${HOME1}
printf "ABC123" | "${CKB_CLI_BIN}" account import --privkey-path <(cat "${PRIV_PATH}")

}

account_import_process_substitution

0 comments on commit 9f49c41

Please sign in to comment.