def test_homecommand(self, client_socket): self.logger.info("Testing home command") req = get_method_template("player-execute", "HomeCommand", lstr("nothing")) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "(0,0,0)", [])
def test_player_get_position(self, client_socket): self.logger.info("Testing get position") req = get_method_template("player-get-position", "", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "(0,0,0)", [])
def test_two_commands(self, client_socket): self.logger.info("Trying to send two commands first with improper line eding") req = get_method_template("player-execute", "HomeCommand", lstr("nothing")) client_socket.send(req+req) response = client_socket.recv(4096) test_response(self.logger, response, "(0,0,0)", [])
def test_logout(self, client_socket): self.logger.info("Logging out") req = get_method_template("cave-logout", "", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "SUCCESS", [])
def test_player_move(self, client_socket): self.logger.info("Testing player move") req = get_method_template("player-move", "DOWN", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "false", [])
def test_player_get_exit_set(self, client_socket): self.logger.info("Testing get exit set") req = get_method_template("player-get-exit-set", "", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "notused", ["NORTH", "EAST", "WEST", "UP"])
def test_player_get_long_description(self, client_socket): self.logger.info("Testing get long room description") req = get_method_template("player-get-long-room-description", "", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "You are standing at the end of a road before a small brick building.\nThere are exits in directions:\n NORTH EAST WEST UP \nYou see other players:\n [0]", [])
def test_player_get_short_description(self, client_socket): self.logger.info("Testing get short room description") req = get_method_template("player-get-short-room-description", "", lstr()) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "You are standing at the end of a road before a small brick building.", [])
def test_login(self, client_socket): self.logger.info("Logging in") req = get_method_template("cave-login", player_login, lstr(player_pass)) client_socket.send(req) response = client_socket.recv(4096) test_response(self.logger, response, "LOGIN_SUCCESS", ["55e45169e4b067dd3c8fa56e", "rohdef"]) res = json.loads(response.decode("utf-8")) set_user_details(res['reply-tail'])