Created
November 13, 2019 06:13
-
-
Save armandomiani/ac8c8a17b29961ef6178d9ee27e9eaa7 to your computer and use it in GitHub Desktop.
MediaWiki Functional Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get install -y jq | |
https://gist.github.com/subfuzion/08c5d85437d5d4f00e58 | |
# Test 301 and redirection | |
curl -L -I -s http://localhost | grep -E "^HTTP/1.1 301|^Location: .*/Main_Page.*$" | |
# api test | |
LOGIN_TOKEN=$(curl "http://localhost/api.php?action=query&meta=tokens&format=json&type=login" | jq -r '.query.tokens.logintoken') | |
CSRF_TOKEN=$(curl "http://localhost/api.php?action=query&meta=tokens&format=json | jq -r '' | |
ACCESS_TOKEN=$(curl -X POST "http://localhost/api.php?action=login&lgname=Admin&format=json" -d "lgpassword=mediawiki1234&lgtoken=${LOGIN_TOKEN}" | jq -r '.login.token') | |
curl "http://localhost/api.php?action=query&list=allpages&format=json" | jq -r '.query.allpages[0].title' | |
curl -X POST "http://localhost/api.php?action=edit&format=json&title=Main_Page&appendtext=Hello" -d "token=${ACCESS_TOKEN}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment