OLD | NEW |
| (Empty) |
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 | |
OLD | NEW |