X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=test;h=0e42462a264d8d8e07063628bf6ff7a951cb4a44;hb=f27cdf8b57b41a91dd7ab67be407d803dcaad1a3;hp=b5be7d8fa20e27142a8acbdb719e950a22b7acf5;hpb=32420152e7e4805104d5118fabc5ada0e668e5ae;p=empires-server diff --git a/test b/test index b5be7d8..0e42462 100755 --- a/test +++ b/test @@ -140,6 +140,24 @@ tictactoe_game_id=$(new_game tictactoe) 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 @@ -274,7 +292,7 @@ tictactoe_game_path=tictactoe/$tictactoe_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" @@ -290,4 +308,3 @@ test "$result" = "false" TEST_END TEST_REPORT -