test "$tictactoe_game_id" != ""
TEST_END $tictactoe_game_id
+TEST_SUBSECTION "Test redirects"
+
+TEST "Redirect of /GAMEID at top level"
+redirect=$(curl_get $empires_game_id)
+test "$redirect" = "Moved Permanently. Redirecting to /empires/$empires_game_id/"
+TEST_END
+
+TEST "Redirect of lowercase /gameid at top level"
+empires_game_id_lower=$(tr '[:upper:]' '[:lower:]' <<< $empires_game_id)
+redirect=$(curl_get $empires_game_id_lower)
+test "$redirect" = "Moved Permanently. Redirecting to /$empires_game_id/"
+TEST_END
+
+TEST "Redirect of lowercase /empires/gameid"
+redirect=$(curl_get empires/$empires_game_id_lower)
+test "$redirect" = "Moved Permanently. Redirecting to /empires/$empires_game_id/"
+TEST_END
+
TEST_SECTION "Empires game"
empires_game_path=empires/$empires_game_id
tictactoe_move()
{
- curl_post $tictactoe_game_path/move "{\"square\": $1}"
+ curl_post $tictactoe_game_path/move "{ \"move\": $1 }"
}
TEST_SUBSECTION "Tic Tac Toe /move"
TEST "Move to the center square"
result=$(tictactoe_move 4)
-test "$result" = "true"
+test "$result" = '{"legal":true}'
TEST_END
TEST "Move to center square again is now illegal"
result=$(tictactoe_move 4)
-test "$result" = "false"
+test "$result" = '{"legal":false,"message":"Square is already occupied"}'
TEST_END
TEST_REPORT
-