content-test.sh 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/usr/bin/env bash
  2. set -e
  3. SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
  4. cd $SCRIPT_PATH
  5. mkdir ~/tmp || true
  6. echo "{}" > ~/tmp/empty.json
  7. export AUTO_CONFIRM=true
  8. export OCLIF_TS_NODE=0
  9. yarn workspace @joystream/cli build
  10. CLI=../bin/run
  11. # Init content lead
  12. GROUP=contentWorkingGroup yarn workspace api-scripts initialize-lead
  13. # Add integration tests lead key (in case the script is executed after ./start.sh)
  14. ${CLI} account:forget --name "Test content lead key" || true
  15. ${CLI} account:import --suri //testing//worker//Content//0 --name "Test content lead key" --password "" || true
  16. # Test create/update/remove category
  17. ${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
  18. ${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
  19. ${CLI} content:createVideoCategory -i ../examples/content/CreateCategory.json
  20. ${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
  21. ${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
  22. ${CLI} content:createChannelCategory -i ../examples/content/CreateCategory.json
  23. ${CLI} content:updateVideoCategory -i ../examples/content/UpdateCategory.json 2
  24. ${CLI} content:updateChannelCategory -i ../examples/content/UpdateCategory.json 2
  25. ${CLI} content:deleteChannelCategory 3
  26. ${CLI} content:deleteVideoCategory 3
  27. # Group 1 - a valid group
  28. ${CLI} content:createCuratorGroup
  29. ${CLI} content:setCuratorGroupStatus 1 1
  30. ${CLI} content:addCuratorToGroup 1 0
  31. # Group 2 - test removeCuratorFromGroup
  32. ${CLI} content:createCuratorGroup
  33. ${CLI} content:addCuratorToGroup 2 0
  34. ${CLI} content:removeCuratorFromGroup 2 0
  35. # Create/update channel
  36. ${CLI} content:createChannel -i ../examples/content/CreateChannel.json --context Member || true
  37. ${CLI} content:createChannel -i ../examples/content/CreateChannel.json --context Curator || true
  38. ${CLI} content:createChannel -i ~/tmp/empty.json --context Member || true
  39. ${CLI} content:updateChannel -i ../examples/content/UpdateChannel.json 1 || true
  40. # Create/update video
  41. ${CLI} content:createVideo -i ../examples/content/CreateVideo.json -c 1 || true
  42. ${CLI} content:createVideo -i ../examples/content/CreateVideo.json -c 2 || true
  43. ${CLI} content:createVideo -i ~/tmp/empty.json -c 2 || true
  44. ${CLI} content:updateVideo -i ../examples/content/UpdateVideo.json 1 || true
  45. # Set featured videos
  46. ${CLI} content:setFeaturedVideos 1,2
  47. ${CLI} content:setFeaturedVideos 2,3
  48. # Update channel censorship status
  49. ${CLI} content:updateChannelCensorshipStatus 1 1 --rationale "Test"
  50. ${CLI} content:updateVideoCensorshipStatus 1 1 --rationale "Test"
  51. # Display-only commands
  52. ${CLI} content:videos
  53. ${CLI} content:video 1
  54. ${CLI} content:channels
  55. ${CLI} content:channel 1
  56. ${CLI} content:curatorGroups
  57. ${CLI} content:curatorGroup 1
  58. # Remove videos/channels/assets
  59. ${CLI} content:removeChannelAssets -c 1 -o 0
  60. ${CLI} content:deleteVideo -v 1 -f
  61. ${CLI} content:deleteVideo -v 2 -f
  62. ${CLI} content:deleteVideo -v 3 -f
  63. ${CLI} content:deleteChannel -c 1 -f
  64. ${CLI} content:deleteChannel -c 2 -f
  65. ${CLI} content:deleteChannel -c 3 -f
  66. # Forget test content lead account
  67. ${CLI} account:forget --name "Test content lead key"