From 9faed097d4d2baee9c69bd6e00afd3c35753207a Mon Sep 17 00:00:00 2001 From: Jack Bates Date: Sun, 7 Aug 2011 14:23:05 -0700 Subject: [PATCH] Cosmetic, s/mail/sender, s/data/content, etc. --- cookie | 34 +++++++++++++++++----------------- test/addAddress | 14 +++++++------- test/addMessageId | 8 ++++---- test/dataError | 18 +++++++++--------- test/dataReply | 10 +++++----- test/from | 8 ++++---- test/httpAdd | 4 ++-- test/httpBad | 4 ++-- test/ignoreAddress | 8 ++++---- test/inReplyTo | 8 ++++---- test/mailError | 14 +++++++------- test/multiConnection | 16 ++++++++-------- test/multiMail | 16 ++++++++-------- test/multiRecipient | 12 ++++++------ test/noWith | 8 ++++---- test/parallelConnection | 16 ++++++++-------- test/rcptError | 20 ++++++++++---------- test/references | 8 ++++---- test/xforward | 4 ++-- 19 files changed, 115 insertions(+), 115 deletions(-) diff --git a/cookie b/cookie index 6c90121..f2ca205 100755 --- a/cookie +++ b/cookie @@ -74,8 +74,8 @@ def _(): ctx.recipient = [].append - def mail(ctx, mailbox): - ctx.sender = mailbox + def sender(ctx, sender): + ctx.sender = sender @promise.continuate def start(ctx, command, state): @@ -108,10 +108,10 @@ def _(): raise StopIteration(state((yield ctx.ctx.command()), state)) @promise.continuate - def data(ctx, data): + def content(ctx, content): if (yield ctx.ctx.reset): try: - rsetReply = yield ctx.ctx.client.rsetCmd() + rsetReply = yield ctx.ctx.client.rset() except smtp.reply as e: ctx.ctx.transport.write(str(e)) @@ -133,12 +133,12 @@ def _(): timeStampLine = qwer('Received:', rfc5322.FWS, stamp, rfc5234.CRLF) try: - timeStampLine.match(data) + timeStampLine.match(content) # Not authenticated, ESMTPA except ValueError: try: - messageId = rfc5322.messageId.search(data, 'idLeft, idRight') + messageId = rfc5322.messageId.search(content, 'idLeft, idRight') except ValueError: pass @@ -153,7 +153,7 @@ def _(): cursor.execute('INSERT INTO message_id (message_id, sender) VALUES (%s, %s)', messageId.join('@'), recipient.localPart) try: - mailReply = yield mail.mailCmd(ctx.sender) + mailReply = yield mail.mail(ctx.sender) except smtp.reply as e: ctx.ctx.transport.write(str(e)) @@ -163,7 +163,7 @@ def _(): for recipient in ctx.recipient.__self__: try: - yield mail.rcptCmd(recipient) + yield mail.rcpt(recipient) except smtp.reply as e: ctx.ctx.reset = True @@ -174,7 +174,7 @@ def _(): raise StopIteration(ctx.afterRecipient((yield ctx.ctx.command()), ctx.afterRecipient)) try: - dataReply = yield mail.dataCmd(data) + dataReply = yield mail.data(content) except smtp.reply as e: @@ -208,7 +208,7 @@ def _(): def messageId(qwer): try: - msgId = qwer.search(data, 'msgId ( idLeft, idRight )') + msgId = qwer.search(content, 'msgId ( idLeft, idRight )') except ValueError: raise Exception @@ -242,7 +242,7 @@ def _(): @promise.continuate def send(*recipient): try: - mailReply = yield mail.mailCmd(sender + '@nottheoilrig.com') + mailReply = yield mail.mail(sender + '@nottheoilrig.com') # Client only raises reply if unexpected/unsuccessful except smtp.reply as e: @@ -253,7 +253,7 @@ def _(): for itm in recipient: try: - yield mail.rcptCmd(itm) + yield mail.rcpt(itm) # Client only raises reply if unexpected/unsuccessful except smtp.reply as e: @@ -266,7 +266,7 @@ def _(): try: #return ... - raise StopIteration(mail.dataCmd(rfc5322.From.replace(untwisted.partial(replace, sender), data, 'mailbox ( nameAddr, displayName, CFWS, localPart, dotAtomText, DQUOTE, domain )', count=1))) + raise StopIteration(mail.data(rfc5322.From.replace(untwisted.partial(replace, sender), content, 'mailbox ( nameAddr, displayName, CFWS, localPart, dotAtomText, DQUOTE, domain )', count=1))) # Client only raises reply if unexpected/unsuccessful except smtp.reply as e: @@ -326,7 +326,7 @@ def _(): for recipient in rest: if reset: try: - rsetReply = yield ctx.ctx.client.rsetCmd() + rsetReply = yield ctx.ctx.client.rset() except smtp.reply: @@ -338,12 +338,12 @@ def _(): sender = address(recipient) try: - mailReply = yield mail.mailCmd(sender + '@nottheoilrig.com') + mailReply = yield mail.mail(sender + '@nottheoilrig.com') try: - yield mail.rcptCmd(recipient) + yield mail.rcpt(recipient) - yield mail.dataCmd(rfc5322.From.replace(untwisted.partial(replace, sender), data, 'mailbox ( nameAddr, displayName, CFWS, localPart, dotAtomText, DQUOTE, domain )', count=1)) + yield mail.data(rfc5322.From.replace(untwisted.partial(replace, sender), content, 'mailbox ( nameAddr, displayName, CFWS, localPart, dotAtomText, DQUOTE, domain )', count=1)) except smtp.reply: diff --git a/test/addAddress b/test/addAddress index c951577..09fe8f3 100755 --- a/test/addAddress +++ b/test/addAddress @@ -17,19 +17,19 @@ def _(): ctx = yield class sample(smtp.server.mail): - def mail(ctx, mailbox): - ctx.sender = mailbox + def sender(ctx, sender): + ctx.sender = sender for cursor in conn: - equiv(((str(mailbox.localPart),),), cursor.execute('SELECT sender FROM address WHERE address = %s', 'bob@example.com')) + equiv(((str(sender.localPart),),), cursor.execute('SELECT sender FROM address WHERE address = %s', 'bob@example.com')) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = lambda ctx, data: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = lambda ctx, content: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: ' + str(ctx.sender), '', - 'la di da')), data) + 'la di da')), content) ctx = yield sample.__get__(ctx)() @@ -45,9 +45,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/addMessageId b/test/addMessageId index 54cc947..5553c18 100755 --- a/test/addMessageId +++ b/test/addMessageId @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('abc123@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTP', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', @@ -43,9 +43,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('abc123@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTP', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/dataError b/test/dataError index 8c5122d..9f7ac7f 100755 --- a/test/dataError +++ b/test/dataError @@ -17,11 +17,11 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) @promise.continuate - def data(ctx, data): + def content(ctx, content): ctx.ctx.transport.write(str(smtp.reply(456, 'Expect'))) command = yield ctx.ctx.command() @@ -34,9 +34,9 @@ def _(): ctx = yield sample.__get__(ctx)() class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) + content = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) ctx = yield sample.__get__(ctx)() @@ -52,20 +52,20 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('la di da',)).next + content = iter(('la di da',)).next @promise.continuate - def dataCmd(ctx, data): + def data(ctx, content): try: - ok(False, (yield smtp.client.mail.dataCmd(ctx, data))) + ok(False, (yield smtp.client.mail.data(ctx, content))) except smtp.reply as e: equal('456 Expect\r\n', str(e)) #return ... - raise StopIteration(smtp.client.mail.dataCmd(ctx, data)) + raise StopIteration(smtp.client.mail.data(ctx, content)) yield sample.__get__(ctx)() diff --git a/test/dataReply b/test/dataReply index 0449745..8566e89 100755 --- a/test/dataReply +++ b/test/dataReply @@ -17,10 +17,10 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - def data(ctx, data): + def content(ctx, content): raise smtp.reply(234, 'Expect') ctx = yield sample.__get__(ctx)() @@ -37,10 +37,10 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('la di da',)).next - dataCmd = promise.compose(untwisted.partial(equal, '234 Expect\r\n'), str, smtp.client.mail.dataCmd) + content = iter(('la di da',)).next + data = promise.compose(untwisted.partial(equal, '234 Expect\r\n'), str, smtp.client.mail.data) yield sample.__get__(ctx)() diff --git a/test/from b/test/from index ee93d3d..bc17677 100755 --- a/test/from +++ b/test/from @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: abc123@nottheoilrig.com', @@ -42,9 +42,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/httpAdd b/test/httpAdd index 2f00241..e34c0a6 100755 --- a/test/httpAdd +++ b/test/httpAdd @@ -17,9 +17,9 @@ def _(): ctx.endHeaders() - def handleResponse(ctx, response): + def handleResponse(ctx, body): for cursor in conn: - equiv(((response,),), cursor.execute('SELECT sender FROM address WHERE address = %s', 'bob@example.com')) + equiv(((body,),), cursor.execute('SELECT sender FROM address WHERE address = %s', 'bob@example.com')) reactor.connectTCP('localhost', 8743, factory) diff --git a/test/httpBad b/test/httpBad index 6e98260..757271f 100755 --- a/test/httpBad +++ b/test/httpBad @@ -17,10 +17,10 @@ def _(): ctx.endHeaders() - def handleResponse(ctx, response): + def handleResponse(ctx, body): pass - handleStatus = lambda ctx, version, status, message: equal('404', status) + handleStatus = lambda ctx, version, code, phrase: equal('404', code) reactor.connectTCP('localhost', 8743, factory) diff --git a/test/ignoreAddress b/test/ignoreAddress index 445ef22..592a947 100755 --- a/test/ignoreAddress +++ b/test/ignoreAddress @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('abc123@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTP', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', @@ -42,9 +42,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('abc123@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTP', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/inReplyTo b/test/inReplyTo index b4204d0..8844f7e 100755 --- a/test/inReplyTo +++ b/test/inReplyTo @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: abc123@nottheoilrig.com', @@ -43,9 +43,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/mailError b/test/mailError index 5de5097..0f782df 100755 --- a/test/mailError +++ b/test/mailError @@ -19,13 +19,13 @@ def _(): class sample(smtp.server.mail): @promise.continuate - def mail(ctx, mailbox): + def sender(ctx, sender): ctx.ctx.transport.write(str(smtp.reply(456, 'Expect'))) equal('MAIL FROM:\r\n', str((yield ctx.ctx.command()))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) + content = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) ctx = yield sample.__get__(ctx)() @@ -41,20 +41,20 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('la di da',)).next + content = iter(('la di da',)).next @promise.continuate - def dataCmd(ctx, data): + def data(ctx, content): try: - ok(False, (yield smtp.client.mail.dataCmd(ctx, data))) + ok(False, (yield smtp.client.mail.data(ctx, content))) except smtp.reply as e: equal('456 Expect\r\n', str(e)) #return ... - raise StopIteration(smtp.client.mail.dataCmd(ctx, data)) + raise StopIteration(smtp.client.mail.data(ctx, content)) yield sample.__get__(ctx)() diff --git a/test/multiConnection b/test/multiConnection index 0e28b7a..b9c8616 100755 --- a/test/multiConnection +++ b/test/multiConnection @@ -17,9 +17,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'la di da')), (yield)))) ctx = yield sample.__get__(ctx)() @@ -36,9 +36,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('dave@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'da di la')), (yield)))) ctx = yield sample.__get__(ctx)() @@ -55,9 +55,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'la di da')),)).next yield sample.__get__(ctx)() @@ -73,9 +73,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('carol@example.com',)).next + sender = iter(('carol@example.com',)).next recipient = iter(('dave@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'da di la')),)).next yield sample.__get__(ctx)() diff --git a/test/multiMail b/test/multiMail index ff5bcba..1814bdc 100755 --- a/test/multiMail +++ b/test/multiMail @@ -17,17 +17,17 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'la di da')), (yield)))) ctx = yield sample.__get__(ctx)() class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('dave@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'da di la')), (yield)))) ctx = yield sample.__get__(ctx)() @@ -44,17 +44,17 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'la di da')),)).next ctx = yield sample.__get__(ctx)() class sample(smtp.client.mail): - mail = iter(('carol@example.com',)).next + sender = iter(('carol@example.com',)).next recipient = iter(('dave@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'da di la')),)).next yield sample.__get__(ctx)() diff --git a/test/multiRecipient b/test/multiRecipient index 7f7b881..089627a 100755 --- a/test/multiRecipient +++ b/test/multiRecipient @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA;', ' Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: abc123@nottheoilrig.com', @@ -31,9 +31,9 @@ def _(): ctx = yield sample.__get__(ctx)() class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('321cba@nottheoilrig.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('321cba@nottheoilrig.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA;', ' Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: 321cba@nottheoilrig.com', @@ -54,9 +54,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com', 'carol@example.com')).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA;', ' Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/noWith b/test/noWith index faddd12..f8a397a 100755 --- a/test/noWith +++ b/test/noWith @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix)', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', @@ -42,9 +42,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix)', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/parallelConnection b/test/parallelConnection index 492c8ac..c4be763 100755 --- a/test/parallelConnection +++ b/test/parallelConnection @@ -14,9 +14,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('carol@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('dave@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'da di la')), (yield)))) ctx = yield sample.__get__(ctx)() @@ -25,9 +25,9 @@ def _(): ctx = yield smtp.server.mail.__get__(ctx)() class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('', 'la di da')), (yield)))) ctx = yield sample.__get__(ctx)() @@ -54,9 +54,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'la di da')),)).next yield sample.__get__(ctx)() @@ -72,9 +72,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('carol@example.com',)).next + sender = iter(('carol@example.com',)).next recipient = iter(('dave@example.com',)).next - data = iter(('\r\n'.join(('', + content = iter(('\r\n'.join(('', 'da di la')),)).next yield sample.__get__(ctx)() diff --git a/test/rcptError b/test/rcptError index 7c5806f..c312e96 100755 --- a/test/rcptError +++ b/test/rcptError @@ -17,10 +17,10 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) @promise.continuate - def recipient(ctx, mailbox): + def recipient(ctx, recipient): ctx.ctx.transport.write(str(smtp.reply(456, 'Expect'))) command = yield ctx.ctx.command() @@ -28,14 +28,14 @@ def _(): equal('RSET\r\n', str(command)) #return ... - raise StopIteration(ctx.afterMail(command, ctx.afterMail)) + raise StopIteration(ctx.afterSender(command, ctx.afterSender)) ctx = yield sample.__get__(ctx)() class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('alice@example.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) + content = staticmethod(untwisted.each(lambda: equal('la di da', str((yield))))) ctx = yield sample.__get__(ctx)() @@ -51,20 +51,20 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('la di da',)).next + content = iter(('la di da',)).next @promise.continuate - def dataCmd(ctx, data): + def data(ctx, content): try: - ok(False, (yield smtp.client.mail.dataCmd(ctx, data))) + ok(False, (yield smtp.client.mail.data(ctx, content))) except smtp.reply as e: equal('456 Expect\r\n', str(e)) #return ... - raise StopIteration(smtp.client.mail.dataCmd(ctx, data)) + raise StopIteration(smtp.client.mail.data(ctx, content)) yield sample.__get__(ctx)() diff --git a/test/references b/test/references index 1f60873..d3ca25e 100755 --- a/test/references +++ b/test/references @@ -19,9 +19,9 @@ def _(): ctx = yield class sample(smtp.server.mail): - mail = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) + sender = staticmethod(untwisted.each(lambda: equal('abc123@nottheoilrig.com', str((yield))))) recipient = staticmethod(untwisted.each(lambda: equal('bob@example.com', str((yield))))) - data = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = staticmethod(untwisted.each(lambda: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: abc123@nottheoilrig.com', @@ -43,9 +43,9 @@ def _(): ctx = yield class sample(smtp.client.mail): - mail = iter(('alice@example.com',)).next + sender = iter(('alice@example.com',)).next recipient = iter(('bob@example.com',)).next - data = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', + content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])', ' by example.com (Postfix) with ESMTPA', ' for ; Fri, 13 Feb 2009 15:31:30 -0800 (PST)', 'From: notalice@example.com', diff --git a/test/xforward b/test/xforward index f7ef3f2..b6c20fe 100755 --- a/test/xforward +++ b/test/xforward @@ -43,13 +43,13 @@ def _(): # Greeting yield ctx.reply() - equal('250-example.com Requested mail action okay, completed\r\n250 XFORWARD NAME ADDR PORT HELO PROTO SOURCE\r\n', str((yield ctx.ehloCmd()))) + equal('250-example.com Requested mail action okay, completed\r\n250 XFORWARD NAME ADDR PORT HELO PROTO SOURCE\r\n', str((yield ctx.ehlo()))) ctx.transport.write(str(smtp.command('XFORWARD NAME=localhost ADDR=127.0.0.1 PORT=1234 HELO=example.com PROTO=ESMTP SOURCE=LOCAL'))) yield ctx.reply() #return ... - raise StopIteration(ctx.quitCmd()) + raise StopIteration(ctx.quit()) yield _