You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 5 години
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. set -e
  3. home_url="http://localhost:$HOST_PORT/"
  4. new_registration_url="http://localhost:$HOST_PORT/register/"
  5. admin_login_url="http://localhost:$HOST_PORT/admin/login/"
  6. echo "Starting container."
  7. $TRAVIS_BUILD_DIR/bootstrap.sh
  8. $TRAVIS_BUILD_DIR/start_docker.sh ${MOUNT_DIR}
  9. sleep 10
  10. # Get status codes
  11. status_code_of_home=`$TRAVIS_BUILD_DIR/tests/http_status_code.sh $home_url`
  12. status_code_of_new_registration=`$TRAVIS_BUILD_DIR/tests/http_status_code.sh $new_registration_url`
  13. status_code_of_admin_login=`$TRAVIS_BUILD_DIR/tests/http_status_code.sh $admin_login_url`
  14. exit_error () {
  15. echo ${1}
  16. exit 1
  17. }
  18. assert_equal () {
  19. [ ${1} = ${2} ] || exit_error "${1} != ${2}, exit now"
  20. }
  21. # enable command echo
  22. set -o xtrace
  23. # Check status codes
  24. case $1 in
  25. private)
  26. assert_equal "$status_code_of_home" "302"
  27. assert_equal "$status_code_of_new_registration" "302"
  28. assert_equal "$status_code_of_admin_login" "302"
  29. exit 0
  30. ;;
  31. allow_new_registrations)
  32. assert_equal "$status_code_of_home" "200"
  33. assert_equal "$status_code_of_new_registration" "200"
  34. assert_equal "$status_code_of_admin_login" "200"
  35. exit 0
  36. ;;
  37. *)
  38. echo "$0 $1: invalid option."
  39. exit 1
  40. esac
  41. exit 1