diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8deecc6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,15 @@ +services: + - docker + +before_install: + - docker build --no-cache -t gollum-galore . + # Don't deamonize, because we want to see the logs + - docker run --rm --name gollum-galore -p 8080:80 -e GOLLUM_PARAMS="--allow-uploads --live-preview" -e CADDY_PARAMS="-conf /gollum/config/Caddyfile" -v $(pwd)/test/Caddyfile:/gollum/config/Caddyfile gollum-galore& + # Wait for gollum-galore to startup + - sleep 5 + - echo "Finish sleeping" + +# Do some basic sanity checks with the container +script: + - chmod +x test/test.sh + - test/test.sh diff --git a/test/Caddyfile b/test/Caddyfile new file mode 100644 index 0000000..811b48e --- /dev/null +++ b/test/Caddyfile @@ -0,0 +1,12 @@ +import /app/Caddyfile + +jwt { + path / + redirect /login + allow sub bob +} + +login { + success_url / + simple bob=secret,alice=secret +} diff --git a/test/test.sh b/test/test.sh new file mode 100644 index 0000000..93d848e --- /dev/null +++ b/test/test.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -o errexit -o nounset -o pipefail + + +main() { + + loginAndCreatePage + +} + +loginAndCreatePage() { + + TOKEN=$(curl "http://localhost:8080/login" --data "username=bob&password=secret") + EXPECTED_CONTENT="ThisIsOurContent" + curl "http://localhost:8080/create" --data \ + "page=Home&path="%"2F&format=markdown&content=${EXPECTED_CONTENT}&message=Created+Home+"%"28markdown"%"29" -H "Cookie: jwt_token=$TOKEN" + curl "http://localhost:8080/Home" -H "Cookie: jwt_token=$TOKEN" | grep ${EXPECTED_CONTENT} + +} + +main "$@" + + +