2 """Regression test script for the mudpy engine."""
4 # Copyright (c) 2004-2015 Jeremy Stanley <fungi@yuggoth.org>. Permission
5 # to use, copy, modify, and distribute this software is granted under
6 # terms provided in the LICENSE file distributed with this software.
13 (0, "Identify yourself:", "luser0"),
14 (0, "Enter your choice:", "n"),
15 (0, "Enter a new password for \"luser0\":", "Test123"),
16 (0, "Enter the same new password again:", "Test123"),
17 (0, "What would you like to do\?", "c"),
18 (0, "Pick a birth gender for your new avatar:", "f"),
19 (0, "Choose a name for her:", "1"),
20 (0, "What would you like to do?", "a"),
21 (0, "Whom would you like to awaken?", ""),
24 (1, "Identify yourself:", "luser1"),
25 (1, "Enter your choice:", "n"),
26 (1, "Enter a new password for \"luser1\":", "Test456"),
27 (1, "Enter the same new password again:", "Test456"),
28 (1, "What would you like to do\?", "c"),
29 (1, "Pick a birth gender for your new avatar:", "m"),
30 (1, "Choose a name for him:", "1"),
31 (1, "What would you like to do?", "a"),
32 (1, "Whom would you like to awaken?", ""),
34 # Actor appears from nowhere
35 (0, "You suddenly realize that .* is here\.", ""),
39 (0, "You suddenly wonder where .* went\.", ""),
45 (0, "What would you like to do?", "d"),
46 (0, "Whom would you like to delete?", ""),
47 (0, "What would you like to do?", "p"),
48 (0, "permanently delete your account?", "y"),
49 (0, "Disconnecting...", ""),
52 (1, "What would you like to do?", "d"),
53 (1, "Whom would you like to delete?", ""),
54 (1, "What would you like to do?", "p"),
55 (1, "permanently delete your account?", "y"),
56 (1, "Disconnecting...", ""),
60 lusers = [telnetlib.Telnet(), telnetlib.Telnet()]
63 luser.open("::1", 6669)
64 for conversant, question, answer in dialogue:
65 print("luser%s waiting for: %s" % (conversant, question))
66 index, match, received = lusers[conversant].expect(
67 [question.encode("utf-8")], 5)
68 captures[conversant] += received.decode("utf-8")
70 print("ERROR: luser%s did not receive expected string:\n\n%s"
71 % (conversant, question))
74 print("luser%s sending: %s" % (conversant, answer))
75 lusers[conversant].write(("%s\r\n" % answer).encode("utf-8"))
76 captures[conversant] += "%s\r\n" % answer
77 for conversant in range(len(captures)):
79 captures[conversant] += lusers[
80 conversant].read_very_eager().decode("utf-8")
83 lusers[conversant].close()
84 log = open("capture_%s.log" % conversant, "w")
85 log.write(captures[conversant])