#!/usr/bin/env python # -*- coding: utf-8 -*- """Regression test script for the mudpy engine.""" # Copyright (c) 2004-2013 Jeremy Stanley . Permission # to use, copy, modify, and distribute this software is granted under # terms provided in the LICENSE file distributed with this software. conversation = ( (b"Identify yourself:", b"testuser"), (b"Enter your choice:", b"n"), (b"Enter a new password for \"testuser\":", b"Test123"), (b"Enter the same new password again:", b"Test123"), (b"What would you like to do?", b"c"), (b"Pick a gender for your new avatar:", b"f"), (b"Choose a name for her:", b"1"), (b"What would you like to do?", b"a"), (b"Whom would you like to awaken?", b""), (b">", b"quit"), (b"What would you like to do?", b"d"), (b"Whom would you like to delete?", b""), (b"What would you like to do?", b"p"), (b"permanently delete your account?", b"y"), (b"Disconnecting...", b""), ) import telnetlib mud = telnetlib.Telnet() mud.open("::1", 6669) for question, answer in conversation: mud.read_until(b"%s " % question) mud.write(b"%s\r\n" % answer) mud.close()