Fix shell-down tutorials
This commit is contained in:
parent
49ebe59804
commit
c6c5e34c3a
|
@ -2,47 +2,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
testTutorial_BasecoinBasics() {
|
testTutorial_BasecoinBasics() {
|
||||||
|
|
||||||
#shelldown[1][3] >/dev/null
|
#shelldown[1][3] >/dev/null
|
||||||
#shelldown[1][4] >/dev/null
|
#shelldown[1][4] >/dev/null
|
||||||
KEYPASS=qwertyuiop
|
KEYPASS=qwertyuiop
|
||||||
|
|
||||||
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[1][6])
|
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[1][6])
|
||||||
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
||||||
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[1][7])
|
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[1][7])
|
||||||
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
||||||
|
|
||||||
#shelldown[3][-1]
|
#shelldown[3][-1]
|
||||||
assertTrue "Expected true for line $LINENO" $?
|
assertTrue "Expected true for line $LINENO" $?
|
||||||
|
|
||||||
#shelldown[4][-1] >>/dev/null 2>&1 &
|
#shelldown[4][-1] >>/dev/null 2>&1 &
|
||||||
sleep 5
|
sleep 5
|
||||||
PID_SERVER=$!
|
PID_SERVER=$!
|
||||||
disown
|
disown
|
||||||
|
|
||||||
RES=$((echo y) | #shelldown[5][-1] $1)
|
RES=$((echo y) | #shelldown[5][-1] $1)
|
||||||
assertTrue "Line $LINENO: Expected to contain validator, got $RES" '[[ $RES == *validator* ]]'
|
assertTrue "Line $LINENO: Expected to contain validator, got $RES" '[[ $RES == *validator* ]]'
|
||||||
|
|
||||||
#shelldown[6][0]
|
#shelldown[6][0]
|
||||||
#shelldown[6][1]
|
#shelldown[6][1]
|
||||||
RES=$(#shelldown[6][2] | jq '.data.coins[0].denom' | tr -d '"')
|
RES=$(#shelldown[6][2] | jq '.data.coins[0].denom' | tr -d '"')
|
||||||
assertTrue "Line $LINENO: Expected to have mycoins, got $RES" '[[ $RES == mycoin ]]'
|
assertTrue "Line $LINENO: Expected to have mycoins, got $RES" '[[ $RES == mycoin ]]'
|
||||||
RES="$(#shelldown[6][3] 2>&1)"
|
RES="$(#shelldown[6][3] 2>&1)"
|
||||||
assertTrue "Line $LINENO: Expected to contain ERROR, got $RES" '[[ $RES == *ERROR* ]]'
|
assertTrue "Line $LINENO: Expected to contain ERROR, got $RES" '[[ $RES == *ERROR* ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[7][-1] | jq '.deliver_tx.code')
|
RES=$((echo $KEYPASS) | #shelldown[7][-1] | jq '.deliver_tx.code')
|
||||||
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
||||||
|
|
||||||
RES=$(#shelldown[8][-1] | jq '.data.coins[0].amount')
|
RES=$(#shelldown[8][-1] | jq '.data.coins[0].amount')
|
||||||
assertTrue "Line $LINENO: Expected to contain 1000 mycoin, got $RES" '[[ $RES == 1000 ]]'
|
assertTrue "Line $LINENO: Expected to contain 1000 mycoin, got $RES" '[[ $RES == 1000 ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[9][-1] | jq '.deliver_tx.code')
|
RES=$((echo $KEYPASS) | #shelldown[9][-1] | jq '.deliver_tx.code')
|
||||||
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[10][-1])
|
RES=$((echo $KEYPASS) | #shelldown[10][-1])
|
||||||
assertTrue "Line $LINENO: Expected to contain insufficient funds error, got $RES" \
|
assertTrue "Line $LINENO: Expected to contain insufficient funds error, got $RES" \
|
||||||
'[[ $RES == *"insufficient funds"* ]]'
|
'[[ $RES == *"Insufficient Funds"* ]]'
|
||||||
|
|
||||||
#perform a substitution within the final tests
|
#perform a substitution within the final tests
|
||||||
HASH=$((echo $KEYPASS) | #shelldown[11][-1] | jq '.hash' | tr -d '"')
|
HASH=$((echo $KEYPASS) | #shelldown[11][-1] | jq '.hash' | tr -d '"')
|
||||||
PRESUB="#shelldown[12][-1]"
|
PRESUB="#shelldown[12][-1]"
|
||||||
|
|
|
@ -2,49 +2,49 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
testTutorial_BasecoinPlugins() {
|
testTutorial_BasecoinPlugins() {
|
||||||
|
|
||||||
#Initialization
|
#Initialization
|
||||||
#shelldown[0][1]
|
#shelldown[0][1]
|
||||||
#shelldown[0][2]
|
#shelldown[0][2]
|
||||||
KEYPASS=qwertyuiop
|
KEYPASS=qwertyuiop
|
||||||
|
|
||||||
#Making Keys
|
#Making Keys
|
||||||
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[0][4])
|
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[0][4])
|
||||||
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
||||||
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[0][5])
|
RES=$((echo $KEYPASS; echo $KEYPASS) | #shelldown[0][5])
|
||||||
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
assertTrue "Line $LINENO: Expected to contain safe, got $RES" '[[ $RES == *safe* ]]'
|
||||||
|
|
||||||
#shelldown[0][7] >/dev/null
|
#shelldown[0][7] >/dev/null
|
||||||
assertTrue "Expected true for line $LINENO" $?
|
assertTrue "Expected true for line $LINENO" $?
|
||||||
|
|
||||||
#shelldown[0][9] >>/dev/null 2>&1 &
|
#shelldown[0][9] >>/dev/null 2>&1 &
|
||||||
sleep 5
|
sleep 5
|
||||||
PID_SERVER=$!
|
PID_SERVER=$!
|
||||||
disown
|
disown
|
||||||
|
|
||||||
RES=$((echo y) | #shelldown[1][0] $1)
|
RES=$((echo y) | #shelldown[1][0] $1)
|
||||||
assertTrue "Line $LINENO: Expected to contain validator, got $RES" '[[ $RES == *validator* ]]'
|
assertTrue "Line $LINENO: Expected to contain validator, got $RES" '[[ $RES == *validator* ]]'
|
||||||
|
|
||||||
#shelldown[1][2]
|
#shelldown[1][2]
|
||||||
assertTrue "Expected true for line $LINENO" $?
|
assertTrue "Expected true for line $LINENO" $?
|
||||||
RES=$((echo $KEYPASS) | #shelldown[1][3] | jq '.deliver_tx.code')
|
RES=$((echo $KEYPASS) | #shelldown[1][3] | jq '.deliver_tx.code')
|
||||||
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[2][0])
|
RES=$((echo $KEYPASS) | #shelldown[2][0])
|
||||||
assertTrue "Line $LINENO: Expected to contain Valid error, got $RES" \
|
assertTrue "Line $LINENO: Expected to contain Valid error, got $RES" \
|
||||||
'[[ $RES == *"Valid must be true"* ]]'
|
'[[ $RES == *"Counter Tx marked invalid"* ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[2][1] | jq '.deliver_tx.code')
|
RES=$((echo $KEYPASS) | #shelldown[2][1] | jq '.deliver_tx.code')
|
||||||
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
||||||
|
|
||||||
RES=$(#shelldown[3][-1] | jq '.data.Counter')
|
RES=$(#shelldown[3][-1] | jq '.data.counter')
|
||||||
assertTrue "Line $LINENO: Expected Counter of 1, got $RES" '[[ $RES == 1 ]]'
|
assertTrue "Line $LINENO: Expected Counter of 1, got $RES" '[[ $RES == 1 ]]'
|
||||||
|
|
||||||
RES=$((echo $KEYPASS) | #shelldown[4][0] | jq '.deliver_tx.code')
|
RES=$((echo $KEYPASS) | #shelldown[4][0] | jq '.deliver_tx.code')
|
||||||
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
assertTrue "Line $LINENO: Expected 0 code deliver_tx, got $RES" '[[ $RES == 0 ]]'
|
||||||
RES=$(#shelldown[4][1])
|
RES=$(#shelldown[4][1])
|
||||||
RESCOUNT=$(printf "$RES" | jq '.data.Counter')
|
RESCOUNT=$(printf "$RES" | jq '.data.counter')
|
||||||
RESFEE=$(printf "$RES" | jq '.data.TotalFees[0].amount')
|
RESFEE=$(printf "$RES" | jq '.data.total_fees[0].amount')
|
||||||
assertTrue "Line $LINENO: Expected Counter of 2, got $RES" '[[ $RESCOUNT == 2 ]]'
|
assertTrue "Line $LINENO: Expected Counter of 2, got $RES" '[[ $RESCOUNT == 2 ]]'
|
||||||
assertTrue "Line $LINENO: Expected TotalFees of 2, got $RES" '[[ $RESFEE == 2 ]]'
|
assertTrue "Line $LINENO: Expected TotalFees of 2, got $RES" '[[ $RESFEE == 2 ]]'
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,8 @@ But the Counter has an additional command, `countercli tx counter`, which
|
||||||
crafts an `AppTx` specifically for this plugin:
|
crafts an `AppTx` specifically for this plugin:
|
||||||
|
|
||||||
```shelldown[2]
|
```shelldown[2]
|
||||||
countercli tx counter --name cool --amount=1mycoin --sequence=2
|
countercli tx counter --name cool --sequence=2
|
||||||
countercli tx counter --name cool --amount=1mycoin --sequence=3 --valid
|
countercli tx counter --name cool --sequence=3 --valid
|
||||||
```
|
```
|
||||||
|
|
||||||
The first transaction is rejected by the plugin because it was not marked as
|
The first transaction is rejected by the plugin because it was not marked as
|
||||||
|
@ -132,7 +132,7 @@ If we send another transaction, and then query again, we will see the value
|
||||||
increment:
|
increment:
|
||||||
|
|
||||||
```shelldown[4]
|
```shelldown[4]
|
||||||
countercli tx counter --name cool --amount=2mycoin --sequence=4 --valid --countfee=2mycoin
|
countercli tx counter --name cool --countfee=2mycoin --sequence=4 --valid
|
||||||
countercli query counter
|
countercli query counter
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue