From 7a6640c356be63663188b9751d97b18eaafb72ee Mon Sep 17 00:00:00 2001 From: Someone Date: Wed, 4 Dec 2019 18:52:29 +0100 Subject: [PATCH] Stuff to manually test GH-12702 --- test_GH-12702.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 test_GH-12702.sh diff --git a/test_GH-12702.sh b/test_GH-12702.sh new file mode 100755 index 0000000..1bc32f2 --- /dev/null +++ b/test_GH-12702.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + +go run cmd/mattermost/main.go user create --email user@example.com --username admin --password password --system_admin +go run cmd/mattermost/main.go team create --display_name test --name test + +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//') +echo "Token is: -${TOKEN}-" + +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//') +echo "TEAM_ID is: -${TEAM_ID}-" + + + +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 +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 + + +mkdir -p /vagrant/test-ws +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 +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 + +cd /vagrant/test-ws +python3 -m http.server 31337 & + + +# now click yourself into the text-mm team, add localhost to internal connections, return to test-team and call /c1 (original) and /c2 (fixed). -- 2.43.0