Regression testing script.
[mudpy.git] / bin / test
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 u"""Regression test script for the mudpy engine."""
4
5 # Copyright (c) 2004-2010 Jeremy Stanley <fungi@yuggoth.org>. Permission
6 # to use, copy, modify, and distribute this software is granted under
7 # terms provided in the LICENSE file distributed with this software.
8
9 conversation = (
10    ( "Identify yourself:"                     , "testuser" ),
11    ( "Enter your choice:"                     , "n"        ),
12    ( "Enter a new password for \"testuser\":" , "Test123"  ),
13    ( "Enter the same new password again:"     , "Test123"  ),
14    ( "What would you like to do?"             , "c"        ),
15    ( "Pick a gender for your new avatar:"     , "f"        ),
16    ( "Choose a name for her:"                 , "1"        ),
17    ( "What would you like to do?"             , "a"        ),
18    ( "Whom would you like to awaken?"         , ""         ),
19    ( ">"                                      , "quit"     ),
20    ( "What would you like to do?"             , "d"        ),
21    ( "Whom would you like to delete?"         , ""         ),
22    ( "What would you like to do?"             , "p"        ),
23    ( "permanently delete your account?"       , "y"        ),
24    ( "Disconnecting..."                       , ""         ),
25 )
26
27 import telnetlib
28 mud = telnetlib.Telnet()
29 mud.open("::1",6669)
30 for question,answer in conversation:
31    mud.read_until("%s " % question)
32    mud.write("%s\r\n" % answer)
33 mud.close()