def execute_command(conn, hashmap):
    command, params = redis_commands.parse(receive_data(conn))
    command_fn = redis_commands.find(command)
    hashmap, response = command_fn(conn, hashmap, *params)
    conn.sendall(response)
    print("--- Received command: %s" % command.upper())
    execute_command(conn, hashmap)
 def test_find_commands(self):
     self.assertEquals(redis_commands.find("set"), redis_commands.set)
     self.assertEquals(redis_commands.find("get"), redis_commands.get)
     self.assertEquals(redis_commands.find("info"), redis_commands.info)
     self.assertEquals(
         redis_commands.find("invalid").func_name, redis_commands._command_not_found("invalid").func_name)
def execute_command(conn, hashmap):
    command, params = redis_commands.parse(receive_data(conn))
    command_fn = redis_commands.find(command)
    hashmap, response = command_fn(conn, hashmap, *params)
    conn.sendall(response)
    execute_command(conn, hashmap)