]> git.somenet.org - pub/jan/mattermost-dev-env.git/blob - test_GH-12702.sh
Stuff to manually test GH-12702
[pub/jan/mattermost-dev-env.git] / test_GH-12702.sh
1 #!/bin/bash
2
3
4 go run cmd/mattermost/main.go user create --email user@example.com --username admin --password password --system_admin
5 go run cmd/mattermost/main.go team create --display_name test --name test
6
7 export TOKEN=$(curl -s -i -d '{"login_id":"user@example.com","password":"password"}' -H 'Content-Type: application/json' http://localhost:8065/api/v4/users/login | grep "Token: " |sed -Ee 's/^Token: //' -e 's/\r//')
8 echo "Token is: -${TOKEN}-"
9
10 export TEAM_ID=$(curl -s -H "Authorization: Bearer ${TOKEN}" -H 'Content-Type: application/json' http://localhost:8065/api/v4/teams | json_pp | grep '"id"' | sed -Ee 's/\s*"id"\s*:\s*"//' -e 's/".*$//' -e 's/\r//')
11 echo "TEAM_ID is: -${TEAM_ID}-"
12
13
14
15 curl -d '{"team_id": "'${TEAM_ID}'", "method": "G", "trigger": "c1", "url": "http://localhost:31337/original.json"}' -s -H "Authorization: Bearer ${TOKEN}" -H 'Content-Type: application/json' http://localhost:8065/api/v4/commands | json_pp
16 curl -d '{"team_id": "'${TEAM_ID}'", "method": "G", "trigger": "c2", "url": "http://localhost:31337/fixed.json"}' -s -H "Authorization: Bearer ${TOKEN}" -H 'Content-Type: application/json' http://localhost:8065/api/v4/commands | json_pp
17
18
19 mkdir -p /vagrant/test-ws
20 echo '{ "text": "**Input**\n```haskell\nlet\n\nf1 = [ 3 | a <- [1]]\nf2 = [ 4 | b <- [2]]\nf3 = \\p -> 5\n\nin 1\n```\n\n**Output**\n```haskell\n1\n```", "username": "lambdabot", "response_type": "in_channel"}' > /vagrant/test-ws/original.json
21 echo '{ "text": "**Input**\n```haskell\nlet\n\nf1 = [ 3 | a <- [1]]\nf2 = [ 4 | b <- [2]]\nf3 = \\p -> 5\n\nin 1\n```\n\n**Output**\n```haskell\n1\n```", "username": "lambdabot", "response_type": "in_channel", "skip_slack_parsing":"true"}' > /vagrant/test-ws/fixed.json
22
23 cd /vagrant/test-ws
24 python3 -m http.server 31337 &
25
26
27 # now click yourself into the text-mm team, add localhost to internal connections, return to test-team and call /c1 (original) and /c2 (fixed).