Download this file

open_relay_tests.py    29 lines (22 with data), 832 Bytes

 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
from nose.tools import *
from lamson.testing import *
import os
from lamson import server
relay = relay(port=8823)
client = RouterConversation("somedude@localhost", "requests_tests")
confirm_format = "testing-confirm-[0-9]+@"
noreply_format = "testing-noreply@"
def test_forwards_relay_host():
"""
Makes sure that your config/settings.py is configured to forward mail from
localhost (or your direct host) to your relay.
"""
client.begin()
client.say("tester@localhost", "Test that forward works.", "tester@localhost")
def test_drops_open_relay_messages():
"""
But, make sure that mail NOT for test.com gets dropped silently.
"""
client.begin()
client.say("tester@badplace.notinterwebs", "Relay should not happen")
assert queue().count() == 0, "Should not deliver that message."