import sys
import telnetlib
+import time
test_account0_setup = (
(0, "Identify yourself:", "luser0"),
captures = ["", ""]
lusers = [telnetlib.Telnet(), telnetlib.Telnet()]
success = True
+start = time.time()
for luser in lusers:
luser.open("::1", 6669)
for test, description in dialogue:
print("\nTesting %s..." % description)
+ test_start = time.time()
for conversant, question, answer in test:
print("luser%s waiting for: %s" % (conversant, question))
index, match, received = lusers[conversant].expect(
captures[conversant] += "%s\r\n" % answer
if not success:
break
+ print("Completed in %.3f seconds." % (time.time() - test_start))
+duration = time.time() - start
+print("")
for conversant in range(len(captures)):
try:
captures[conversant] += lusers[
log = open("capture_%s.log" % conversant, "w")
log.write(captures[conversant])
log.close()
-if not success:
+print("\nRan %s tests in %.3f seconds." % (len(dialogue), duration))
+if success:
+ print("SUCCESS")
+else:
+ print("FAILURE")
sys.exit(1)