Browse Source

CLI: Fix test scripts

Leszek Wiesner 3 years ago
parent
commit
c76a12e19c
2 changed files with 63 additions and 46 deletions
  1. 50 44
      cli/scripts/content-test.sh
  2. 13 2
      cli/scripts/membership-test.sh

+ 50 - 44
cli/scripts/content-test.sh

@@ -4,64 +4,70 @@ set -e
 SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
 cd $SCRIPT_PATH
 
+mkdir ~/tmp || true
 echo "{}" > ~/tmp/empty.json
 
 export AUTO_CONFIRM=true
+export OCLIF_TS_NODE=0
+
+yarn workspace @joystream/cli build
+
+CLI=../bin/run
 
 # Init content lead
 GROUP=contentWorkingGroup yarn workspace api-scripts initialize-lead
 # Add integration tests lead key (in case the script is executed after ./start.sh)
-yarn joystream-cli account:forget --name "Test content lead key" || true
-yarn joystream-cli account:import --suri //testing//worker//Content//0 --name "Test content lead key" --password "" || true
+${CLI} account:forget --name "Test content lead key" || true
+${CLI} account:import --suri //testing//worker//Content//0 --name "Test content lead key" --password "" || true
 # Test create/update/remove category
-yarn joystream-cli content:createVideoCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:createVideoCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:createVideoCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:createChannelCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:createChannelCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:createChannelCategory -i ./examples/content/CreateCategory.json
-yarn joystream-cli content:updateVideoCategory -i ./examples/content/UpdateCategory.json 2
-yarn joystream-cli content:updateChannelCategory -i ./examples/content/UpdateCategory.json 2
-yarn joystream-cli content:deleteChannelCategory 3
-yarn joystream-cli content:deleteVideoCategory 3
+${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
+${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
+${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
+${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
+${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
+${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
+${CLI} content:updateVideoCategory -i ../examples/content/UpdateCategory.json 2
+${CLI} content:updateChannelCategory -i ../examples/content/UpdateCategory.json 2
+${CLI} content:deleteChannelCategory 3
+${CLI} content:deleteVideoCategory 3
 # Group 1 - a valid group
-yarn joystream-cli content:createCuratorGroup
-yarn joystream-cli content:setCuratorGroupStatus 1 1
-yarn joystream-cli content:addCuratorToGroup 1 0
+${CLI} content:createCuratorGroup
+${CLI} content:setCuratorGroupStatus 1 1
+${CLI} content:addCuratorToGroup 1 0
 # Group 2 - test removeCuratorFromGroup
-yarn joystream-cli content:createCuratorGroup
-yarn joystream-cli content:addCuratorToGroup 2 0
-yarn joystream-cli content:removeCuratorFromGroup 2 0
+${CLI} content:createCuratorGroup
+${CLI} content:addCuratorToGroup 2 0
+${CLI} content:removeCuratorFromGroup 2 0
 # Create/update channel
-yarn joystream-cli content:createChannel -i ./examples/content/CreateChannel.json --context Member || true
-yarn joystream-cli content:createChannel -i ./examples/content/CreateChannel.json --context Curator || true
-yarn joystream-cli content:createChannel -i ~/tmp/empty.json --context Member || true
-yarn joystream-cli content:updateChannel -i ./examples/content/UpdateChannel.json 1 || true
+${CLI} content:createChannel -i ../examples/content/CreateChannel.json --context Member || true
+${CLI} content:createChannel -i ../examples/content/CreateChannel.json --context Curator || true
+${CLI} content:createChannel -i ~/tmp/empty.json --context Member || true
+${CLI} content:updateChannel -i ../examples/content/UpdateChannel.json 1 || true
 # Create/update video
-yarn joystream-cli content:createVideo -i ./examples/content/CreateVideo.json -c 1 || true
-yarn joystream-cli content:createVideo -i ./examples/content/CreateVideo.json -c 2 || true
-yarn joystream-cli content:createVideo -i ~/tmp/empty.json -c 2 || true
-yarn joystream-cli content:updateVideo -i ./examples/content/UpdateVideo.json 1 || true
+${CLI} content:createVideo -i ../examples/content/CreateVideo.json -c 1 || true
+${CLI} content:createVideo -i ../examples/content/CreateVideo.json -c 2 || true
+${CLI} content:createVideo -i ~/tmp/empty.json -c 2 || true
+${CLI} content:updateVideo -i ../examples/content/UpdateVideo.json 1 || true
 # Set featured videos
-yarn joystream-cli content:setFeaturedVideos 1,2
-yarn joystream-cli content:setFeaturedVideos 2,3
+${CLI} content:setFeaturedVideos 1,2
+${CLI} content:setFeaturedVideos 2,3
 # Update channel censorship status
-yarn joystream-cli content:updateChannelCensorshipStatus 1 1 --rationale "Test"
-yarn joystream-cli content:updateVideoCensorshipStatus 1 1 --rationale "Test"
+${CLI} content:updateChannelCensorshipStatus 1 1 --rationale "Test"
+${CLI} content:updateVideoCensorshipStatus 1 1 --rationale "Test"
 # Display-only commands
-yarn joystream-cli content:videos
-yarn joystream-cli content:video 1
-yarn joystream-cli content:channels
-yarn joystream-cli content:channel 1
-yarn joystream-cli content:curatorGroups
-yarn joystream-cli content:curatorGroup 1
+${CLI} content:videos
+${CLI} content:video 1
+${CLI} content:channels
+${CLI} content:channel 1
+${CLI} content:curatorGroups
+${CLI} content:curatorGroup 1
 # Remove videos/channels/assets
-yarn joystream-cli content:removeChannelAssets -c 1 -o 0
-yarn joystream-cli content:deleteVideo -v 1 -f
-yarn joystream-cli content:deleteVideo -v 2 -f
-yarn joystream-cli content:deleteVideo -v 3 -f
-yarn joystream-cli content:deleteChannel -c 1 -f
-yarn joystream-cli content:deleteChannel -c 2 -f
-yarn joystream-cli content:deleteChannel -c 3 -f
+${CLI} content:removeChannelAssets -c 1 -o 0
+${CLI} content:deleteVideo -v 1 -f
+${CLI} content:deleteVideo -v 2 -f
+${CLI} content:deleteVideo -v 3 -f
+${CLI} content:deleteChannel -c 1 -f
+${CLI} content:deleteChannel -c 2 -f
+${CLI} content:deleteChannel -c 3 -f
 # Forget test content lead account
-yarn joystream-cli account:forget --name "Test content lead key"
+${CLI} account:forget --name "Test content lead key"

+ 13 - 2
cli/scripts/membership-test.sh

@@ -5,6 +5,9 @@ SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
 cd $SCRIPT_PATH
 
 export AUTO_CONFIRM=true
+export OCLIF_TS_NODE=0
+
+yarn workspace @joystream/cli build
 
 CLI=../bin/run
 
@@ -12,6 +15,7 @@ CLI=../bin/run
 ${CLI} account:forget --name test_alice_member_controller_1 || true
 ${CLI} account:forget --name test_alice_member_root_1 || true
 ${CLI} account:forget --name test_alice_member_controller_2 || true
+${CLI} account:forget --name test_alice_member_staking || true
 
 # Create membership (controller: //Alice//controller, root: //Alice//root, sender: //Alice)
 MEMBER_HANDLE="alice-$(date +%s)"
@@ -74,10 +78,16 @@ ${CLI} account:transferTokens\
   --from 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\
   --to 5E5JemkFX48JMRFraGZrjPwKL1HnhLkPrMQxaBvoSXPmzKab
 
-# Add staking account
+# Import //Alice//staking key
+${CLI} account:import\
+  --suri //Alice//staking\
+  --name test_alice_member_staking\
+  --password=""
+
+# Add staking account (//Alice//staking)
 ${CLI} membership:addStakingAccount\
   --useMemberId="$MEMBER_ID"\
-  --address="5EHDeBnBEyNB2aCFEhcxiEdcQLLnyP96t8ghoxBXUmK2itQp"\
+  --address="5EheygkSi4q4QCN12d2Vy65EnoEtdJy6yw6o7XZpPRcaVJCS"\
   --fundsSource="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"\
   --withBalance="10000"
 
@@ -85,3 +95,4 @@ ${CLI} membership:addStakingAccount\
 ${CLI} account:forget --name test_alice_member_controller_1
 ${CLI} account:forget --name test_alice_member_root_1
 ${CLI} account:forget --name test_alice_member_controller_2
+${CLI} account:forget --name test_alice_member_staking