Skip to content

Commit

Permalink
Update test/scripts/e2e_subs/goal-account-asset.sh
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Paulos <jasonpaulos@users.noreply.github.com>
  • Loading branch information
gmalouf and jasonpaulos authored May 3, 2024
1 parent 778cadf commit 737c178
Showing 1 changed file with 79 additions and 6 deletions.
85 changes: 79 additions & 6 deletions test/scripts/e2e_subs/goal-account-asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,89 @@ ${gcmd} asset optin --account ${ACCOUNTB} --assetid ${ASSET_D_ID} --signer ${ACC
# displays held assets
${gcmd} account info -a ${ACCOUNTB}

# query account assets w/ details
${gcmd} account assetdetails -a ${ACCOUNTA} -l 2 -n 1004
${gcmd} account assetdetails -a ${ACCOUNTB}
# wait a few rounds for the asset optins to get into the db, since the account asset info endpoint
# does not look at in memory deltas
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}

# query account assets w/ details, (1)
RES=$(${gcmd} account assetdetails -a ${ACCOUNTB})
if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then
date '+goal-account-asset-test assetdetails (1) should be for correct account %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_A_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (1) should contain asset A %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_B_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (1) should contain asset B %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (1) should contain asset C %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (1) should contain asset D %Y%m%d_%H%M%S'
false
fi

# query account assets w/ details, limit 2, next set to asset B, (2)
RES=$(${gcmd} account assetdetails -a ${ACCOUNTB} -l 2 -n ${ASSET_B_ID})
if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then
date '+goal-account-asset-test assetdetails (2) should be for correct account %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} == *"Asset ID: ${ASSET_A_ID}"* ]]; then
date '+goal-account-asset-test assetdetails (2) should not contain asset A %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} == *"Asset ID: ${ASSET_B_ID}"* ]]; then
date '+goal-account-asset-test assetdetails (2) should not contain asset B %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (2) should contain asset C %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (2) should contain asset D %Y%m%d_%H%M%S'
false
fi

# delete one of the asset
${gcmd} asset destroy --assetid ${ASSET_B_ID} --creator ${ACCOUNTA} --signer ${ACCOUNTA}

# query account assets w/ details
${gcmd} account assetdetails -a ${ACCOUNTA} -l 2 -n 1004
${gcmd} account assetdetails -a ${ACCOUNTB}
# wait a few rounds for the deletion to get into the db
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}
${gcmd} clerk send -a 0 -f ${ACCOUNTA} -t ${ACCOUNTB}

# query account assets w/ details after deletion, (3)
RES=$(${gcmd} account assetdetails -a ${ACCOUNTB})
if [[ ${RES} != *"Account: ${ACCOUNTB}"* ]]; then
date '+goal-account-asset-test assetdetails (3) should be for correct account %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_A_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (3) should contain asset A %Y%m%d_%H%M%S'
false
fi
# ensure asset B is still present, but its params are unavailable
if [[ ${RES} != *"Asset ID: ${ASSET_B_ID}"$'\n'" Amount (without formatting): 0"* ]]; then
date '+goal-account-asset-test assetdetails (3) should contain asset B without asset params %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_C_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (3) should contain asset C %Y%m%d_%H%M%S'
false
fi
if [[ ${RES} != *"Asset ID: ${ASSET_D_ID}"$'\n'" Amount: 0"* ]]; then
date '+goal-account-asset-test assetdetails (3) should contain asset D %Y%m%d_%H%M%S'
false
fi

# check account info display
RES=$(${gcmd} account info -a ${ACCOUNTB})
Expand Down

0 comments on commit 737c178

Please sign in to comment.