Ejemplo n.º 1
0
> Hmm I think I see what you mean: one needn't manually pass on the
> namespace to a ZPT?
Yeah, Page Templates are a bit more clever, sadly, DTML methods aren't :-(
Chris
"""
import re
import sys
import socket
import getopt
import asyncore
import operator
import unittest
import thread
import smtplib
import sb_test_support
sb_test_support.fix_sys_path()
from spambayes import Dibbler
from spambayes import tokenizer
from spambayes.Options import options
from sb_server import state, _recreateState
from spambayes.smtpproxy import BayesSMTPProxyListener, SMTPTrainer
from spambayes.ProxyUI import ProxyUserInterface
from spambayes.UserInterface import UserInterfaceServer
from spambayes.classifier import Classifier
class TestListener(Dibbler.Listener):
    """Listener for TestSMTPServer."""
    def __init__(self, socketMap=asyncore.socket_map):
        Dibbler.Listener.__init__(self, 8025, TestSMTPServer,
                              (socketMap,), socketMap=socketMap)
class TestSMTPServer(Dibbler.BrighterAsyncChat):
    """Minimal SMTP server, for testing purposes.  Understands
Ejemplo n.º 2
0
# Test sb_pop3dnd script.

import sys
import email
import time
import thread
import imaplib
import unittest

import sb_test_support
sb_test_support.fix_sys_path()

from spambayes import Dibbler
from spambayes.Options import options
from spambayes.classifier import Classifier
from spambayes.message import SBHeaderMessage
from sb_pop3dnd import IMAPMessage, DynamicIMAPMessage, IMAPFileMessage
from sb_pop3dnd import IMAPFileMessageFactory
# We borrow the dummy POP3 server that test_sb_server uses.
# And also the test messages.
from test_sb_server import TestListener, good1, spam1

POP_PORT = 8110


class IMAPMessageTest(unittest.TestCase):
    def testIMAPMessage(self):
        msg = IMAPMessage()
        self.assertEqual(msg.date, None)
        msg = IMAPMessage("fake date")
        self.assertEqual(msg.date, "fake date")