Permalink
Browse files

add unexpected server disconnection to test curpus for google

  • Loading branch information...
mhammond committed Mar 17, 2011
1 parent 0c1d187 commit 19c560178cd40cd86f67a9d7ad93873a7dced1bb
@@ -0,0 +1,7 @@
+{
+ "error": {
+ "message": "Connection unexpectedly closed",
+ "provider": "smtp.gmail.com"
+ },
+ "result": null
+}
@@ -0,0 +1,4 @@
+{
+ "protocol": "smtp",
+ "reason": "smtp exception"
+}
@@ -0,0 +1,23 @@
+< 220 mx.google.com ESMTP 25sm1848097wfb.22
+> ehlo [192.168.0.9]
+< 250 mx.google.com at your service, [58.160.65.179]
++ SIZE 35651584
++ 8BITMIME
++ STARTTLS
++ ENHANCEDSTATUSCODES
+> STARTTLS
+< 220 2.0.0 Ready to start TLS
+> ehlo [192.168.0.9]
+< 250 mx.google.com at your service, [58.160.65.179]
++ SIZE 35651584
++ 8BITMIME
++ AUTH LOGIN PLAIN XOAUTH
++ ENHANCEDSTATUSCODES
+> AUTH XOAUTH R0VUIGh0dHBzOi8vbWFpbC5nb29nbGUuY29tL21haWwvYi9za2lwcHkuaGFtbW9uZC50ZXN0QGdtYWlsLmNvbS9zbXRwLyBvYXV0aF9jb25zdW1lcl9rZXk9Imxpbmtkcm9wLmNhcmF2ZW8uY29tIixvYXV0aF9ub25jZT0iNzYxNzMyMjAiLG9hdXRoX3NpZ25hdHVyZT0iQ3EzZmFUNyUyQjJ4VDF0Q0JYNTBXMnUlMkY4b1BGVSUzRCIsb2F1dGhfc2lnbmF0dXJlX21ldGhvZD0iSE1BQy1TSEExIixvYXV0aF90aW1lc3RhbXA9IjEzMDAzMjU5NjMiLG9hdXRoX3Rva2VuPSIxJTJGeFh4ZEJJRGpxMVBoaFhzQnBYU1FUemNYTHZDN3RYNHJMX2ZWaHhQOTJKQSIsb2F1dGhfdmVyc2lvbj0iMS4wIg==
+< 235 2.7.0 Accepted
+> mail FROM:<skippy.hammond.test@gmail.com> size=6054
+< 250 2.1.0 OK 25sm1848097wfb.22
+> rcpt TO:<mhammond@skippinet.com.au>
+< 250 2.1.5 OK 25sm1848097wfb.22
+> data
+E {"args": ["Connection unexpectedly closed"], "name": "SMTPServerDisconnected", "module": "smtplib"}
@@ -1,3 +1,4 @@
+import sys
import os
import glob
import unittest
@@ -55,6 +56,12 @@ def connect(self, host='localhost', port = 0):
def _get_next_comms(self):
result = []
line = self.next_playback
+ if line.startswith("E "):
+ # a recorded exception - reconstitute it...
+ exc_info = json.loads(line[2:])
+ module = sys.modules[exc_info['module']] if exc_info['module'] else __builtins__
+ exc_class = getattr(module, exc_info['name'])
+ raise exc_class(*tuple(exc_info['args']))
if not line.startswith("< ") and not line.startswith("> "):
# hrm - this implies something is wrong maybe?
raise RuntimeError("strange: %r" % (line,))

0 comments on commit 19c5601

Please sign in to comment.