示例#1
0
def test_mapping():
    anon = addressing.mapping(user_real, 'user', host)
    anon_id = anon.split('@')[0]

    assert_equal(addressing.lookup(anon_id), user_real)
    assert_equal(addressing.lookup(user_real), anon_id)
    assert_equal(addressing.lookup(anon_id), user_real)

    addressing.delete(anon_id)
    addressing.delete(user_real)
示例#2
0
def test_mapping():
    anon = addressing.mapping(user_real, 'user', host)
    anon_id = anon.split('@')[0]

    assert_equal(addressing.lookup(anon_id), user_real)
    assert_equal(addressing.lookup(user_real), anon_id)
    assert_equal(addressing.lookup(anon_id), user_real)

    addressing.delete(anon_id)
    addressing.delete(user_real)
示例#3
0
文件: anonymizer.py 项目: 3kwa/lamson
def START(message, user_id=None, host=None):
    if user_id:
        market_anon = addressing.mapping(message['from'], 'marketroid', host)

        reply = filter.cleanse_incoming(message, user_id, host, market_anon)
        relay.deliver(reply)

        return DEMARKETING
    else:
        CONFIRM.send(relay, "start", message, "mail/start_confirm.msg", locals())
        return CONFIRMING
示例#4
0
def START(message, user_id=None, host=None):
    if user_id:
        market_anon = addressing.mapping(message['from'], 'marketroid', host)

        reply = filter.cleanse_incoming(message, user_id, host, market_anon)
        relay.deliver(reply)

        return DEMARKETING
    else:
        CONFIRM.send(relay, "start", message, "mail/start_confirm.msg",
                     locals())
        return CONFIRMING
示例#5
0
文件: anonymizer.py 项目: 3kwa/lamson
def CONFIRMING(message, id_number=None, host=None):
    original = CONFIRM.verify('start', message['from'], id_number)

    if original:
        user_anon = addressing.mapping(message['from'], 'user', host)

        welcome = view.respond(locals(), "mail/welcome.msg", 
                           From=user_anon,
                           To=message['from'],
                           Subject="Welcome to MyInboxIsNotA.TV")
        relay.deliver(welcome)

        return PROTECTING
    else:
        logging.warning("Invalid confirm from %s", message['from'])
        return CONFIRMING
示例#6
0
def CONFIRMING(message, id_number=None, host=None):
    original = CONFIRM.verify('start', message['from'], id_number)

    if original:
        user_anon = addressing.mapping(message['from'], 'user', host)

        welcome = view.respond(locals(),
                               "mail/welcome.msg",
                               From=user_anon,
                               To=message['from'],
                               Subject="Welcome to MyInboxIsNotA.TV")
        relay.deliver(welcome)

        return PROTECTING
    else:
        logging.warning("Invalid confirm from %s", message['from'])
        return CONFIRMING
示例#7
0
from nose.tools import *
from lamson.testing import *
from lamson import mail
from config import settings
from app.model import filter, addressing


host = 'myinboxisnota.tv'
user = '******'
user_anon_addr = addressing.mapping(user, 'user', host)
marketroid = '*****@*****.**'
mk_anon_addr = addressing.mapping(marketroid, 'marketroid', host)
user_id = user_anon_addr.split('@')[0]
marketroid_id = mk_anon_addr.split('@')[0]


from_marketroid = mail.MailResponse(From=marketroid, To=user_anon_addr, Subject="Buy my crap!",
                                    Html="<html></body>You should buy this!</body></html>")
from_user = mail.MailResponse(From=user, To=mk_anon_addr, Subject="No thanks.",
                              Body="Sorry but I'd rather not.")


def setup():
    addressing.store(user_id, user)
    addressing.store(marketroid_id, marketroid)
    addressing.store(marketroid, marketroid_id)

def teardown():
    addressing.delete(user_id)
    addressing.delete(marketroid_id)
    addressing.delete(marketroid)
示例#8
0
from nose.tools import *
from lamson.testing import *
from lamson import mail
from config import settings
from app.model import filter, addressing

host = 'myinboxisnota.tv'
user = '******'
user_anon_addr = addressing.mapping(user, 'user', host)
marketroid = '*****@*****.**'
mk_anon_addr = addressing.mapping(marketroid, 'marketroid', host)
user_id = user_anon_addr.split('@')[0]
marketroid_id = mk_anon_addr.split('@')[0]

from_marketroid = mail.MailResponse(
    From=marketroid,
    To=user_anon_addr,
    Subject="Buy my crap!",
    Html="<html></body>You should buy this!</body></html>")
from_user = mail.MailResponse(From=user,
                              To=mk_anon_addr,
                              Subject="No thanks.",
                              Body="Sorry but I'd rather not.")


def setup():
    addressing.store(user_id, user)
    addressing.store(marketroid_id, marketroid)
    addressing.store(marketroid, marketroid_id)