]> git.cworth.org Git - empires-server/blobdiff - test
game: Add a new /player endpoint to allow a player to change their name
[empires-server] / test
diff --git a/test b/test
index 9ba61855248404a144bb44dfeaca9b38e83ec550..e19539b16ba09d9177986689113b139b94f03a50 100755 (executable)
--- a/test
+++ b/test
@@ -317,6 +317,11 @@ tictactoe_player_info()
         | grep ^data
 }
 
+tictactoe_player()
+{
+    curl_put $tictactoe_game_path/player "{ \"name\": \"$1\" }" "-b .test-cookie"
+}
+
 TEST_SUBSECTION "Tic Tac Toe player-info"
 
 TEST "Hit LMNO /profile to set name to 'curl'"
@@ -328,6 +333,17 @@ result=$(tictactoe_player_info)
 test "$result" = 'data: {"id":1,"name":"curl"}'
 TEST_END
 
+TEST_SUBSECTION "Tic Tac Toe /player"
+
+TEST "Change name to 'newname'"
+tictactoe_player newname
+TEST_END
+
+TEST "Verify player-info event reports 'newname'"
+result=$(tictactoe_player_info)
+test "$result" = 'data: {"id":1,"name":"newname"}'
+TEST_END
+
 TEST_SUBSECTION "Tic Tac Toe /move"
 
 TEST "Move to the center square"