content-test.sh 3.5 KB

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