~landscape/zope3/newer-from-ztk

« back to all changes in this revision

Viewing changes to src/twisted/mail/test/test_options.py

  • Committer: Thomas Hervé
  • Date: 2009-07-08 13:52:04 UTC
  • Revision ID: thomas@canonical.com-20090708135204-df5eesrthifpylf8
Remove twisted copy

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
from twisted.trial.unittest import TestCase
3
 
 
4
 
from twisted.python.usage import UsageError
5
 
from twisted.mail.tap import Options
6
 
 
7
 
 
8
 
class OptionsTestCase(TestCase):
9
 
    """
10
 
    Tests for the command line option parser used for C{mktap mail}.
11
 
    """
12
 
    def setUp(self):
13
 
        self.aliasFilename = self.mktemp()
14
 
        aliasFile = file(self.aliasFilename, 'w')
15
 
        aliasFile.write('someuser:\tdifferentuser\n')
16
 
        aliasFile.close()
17
 
 
18
 
 
19
 
    def testAliasesWithoutDomain(self):
20
 
        """
21
 
        Test that adding an aliases(5) file before adding a domain raises a
22
 
        UsageError.
23
 
        """
24
 
        self.assertRaises(
25
 
            UsageError,
26
 
            Options().parseOptions,
27
 
            ['--aliases', self.aliasFilename])
28
 
 
29
 
 
30
 
    def testAliases(self):
31
 
        """
32
 
        Test that adding an aliases(5) file to an IAliasableDomain at least
33
 
        doesn't raise an unhandled exception.
34
 
        """
35
 
        Options().parseOptions([
36
 
            '--maildirdbmdomain', 'example.com=example.com',
37
 
            '--aliases', self.aliasFilename])
38