-
Notifications
You must be signed in to change notification settings - Fork 0
/
addAddress
executable file
·59 lines (44 loc) · 1.62 KB
/
addAddress
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
from cookie.test import *
from untwisted import smtp
expect(3)
@sdfg
def _():
#@listen().then
@untwisted.identity(listen().then)
class _(smtp.server):
@untwisted.each
def mail():
ctx = yield
class sample(smtp.server.mail):
def sender(ctx, sender):
ctx.sender = sender
for cursor in conn:
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)))))
content = lambda ctx, content: equal('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])',
' by example.com (Postfix) with ESMTPA',
' for <notbob@example.com>; Fri, 13 Feb 2009 15:31:30 -0800 (PST)',
'From: ' + str(ctx.sender),
'',
'la di da')), content)
ctx = yield sample.__get__(ctx)()
# QUIT
yield smtp.server.mail.__get__(ctx)()
#@connect().then
@untwisted.identity(connect().then)
class _(smtp.client):
@untwisted.each
def mail():
ctx = yield
class sample(smtp.client.mail):
sender = iter(('alice@example.com',)).next
recipient = iter(('bob@example.com',)).next
content = iter(('\r\n'.join(('Received: from example.com (localhost [127.0.0.1])',
' by example.com (Postfix) with ESMTPA',
' for <notbob@example.com>; Fri, 13 Feb 2009 15:31:30 -0800 (PST)',
'From: notalice@example.com',
'',
'la di da')),)).next
yield sample.__get__(ctx)()
yield _