Skip to content

Instantly share code, notes, and snippets.

@runningman84
Created August 30, 2019 11:00
Show Gist options
  • Save runningman84/b122d78ede1869b8b06811658e21e833 to your computer and use it in GitHub Desktop.
Save runningman84/b122d78ede1869b8b06811658e21e833 to your computer and use it in GitHub Desktop.
bats
#!/usr/bin/env bats
@test "Check that we have a /tmp directory" {
run stat /tmp
[ $status = 0 ]
}
@test "Check that we get redirected from http to https" {
run curl -I http://$WP_DEFAULT_HOST/
[ $status = 0 ]
[[ $output =~ "301" ]]
}
@test "Check that we can fetch the startpage" {
run curl -I https://$WP_DEFAULT_HOST/
[ $status = 0 ]
[[ $output =~ "200" ]]
}
@test "Check that we get the correct content of the startpage" {
run curl https://$WP_DEFAULT_HOST/
[[ $output =~ "doctype html" ]]
[[ $output =~ "WordPress" ]]
}
@test "Check that we can fetch the loginpage" {
run curl -I https://$WP_DEFAULT_HOST/wp-login.php
[ $status = 0 ]
[[ $output =~ "200" ]]
}
@test "Check that we cannot fetch the wp-config.conf" {
run curl -I https://$WP_DEFAULT_HOST/wp-config.php
[ $status = 0 ]
[[ $output =~ "403" ]]
}
@test "Check that we cannot fetch the wp-settings.conf" {
run curl -I https://$WP_DEFAULT_HOST/wp-settings.php
[ $status = 0 ]
[[ $output =~ "403" ]]
}
@test "Check that we cannot fetch the readme.html" {
run curl -I https://$WP_DEFAULT_HOST/readme.html
[ $status = 0 ]
[[ $output =~ "403" ]]
}
@test "Check that we cannot fetch the license.html" {
run curl -I https://$WP_DEFAULT_HOST/license.html
[ $status = 0 ]
[[ $output =~ "403" ]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment