refactor: fix computation test and remove the app-specific hsts value

The default for an app is empty, meaning it will fallback to the global value (which defaults to true). This will allow users to properly override the global value, regardless of what it is.
This commit is contained in:
Jose Diaz-Gonzalez
2021-01-23 15:49:40 -05:00
parent 8cc92680c5
commit 5cac43fe55
4 changed files with 34 additions and 16 deletions

View File

@@ -119,8 +119,12 @@ teardown() {
# disable hsts globally
run /bin/bash -c "dokku nginx:set --global hsts false"
echo "output: $output"
echo "status: $status"
assert_success
# check it is now not applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
run /bin/bash -c "dokku proxy:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
@@ -128,17 +132,25 @@ teardown() {
# apply on app
run /bin/bash -c "dokku nginx:set $TEST_APP hsts true"
echo "output: $output"
echo "status: $status"
assert_success
# check it is now applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
run /bin/bash -c "dokku proxy:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success
assert_output_contains "Enabling HSTS" 1
# disable globally
# set global value to default
run /bin/bash -c "dokku nginx:set --global hsts"
echo "output: $output"
echo "status: $status"
assert_success
# check it is still applied
run /bin/bash -c "dokku nginx:build-config $TEST_APP"
run /bin/bash -c "dokku proxy:build-config $TEST_APP"
echo "output: $output"
echo "status: $status"
assert_success