Mercurial > p > roundup > code
comparison test/test_mailgw.py @ 1512:9b93d140b8e6
role names made case insensitive
| author | Andrey Lebedev <kedder@users.sourceforge.net> |
|---|---|
| date | Thu, 13 Mar 2003 09:27:24 +0000 |
| parents | ca3e0e2320be |
| children | a53a7e197360 |
comparison
equal
deleted
inserted
replaced
| 1510:06863714a9f7 | 1512:9b93d140b8e6 |
|---|---|
| 6 # | 6 # |
| 7 # This module is distributed in the hope that it will be useful, | 7 # This module is distributed in the hope that it will be useful, |
| 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 10 # | 10 # |
| 11 # $Id: test_mailgw.py,v 1.40 2003-02-28 03:33:25 richard Exp $ | 11 # $Id: test_mailgw.py,v 1.41 2003-03-13 09:27:24 kedder Exp $ |
| 12 | 12 |
| 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib | 13 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib |
| 14 | 14 |
| 15 # Note: Should parse emails according to RFC2822 instead of performing a | 15 # Note: Should parse emails according to RFC2822 instead of performing a |
| 16 # literal string comparision. Parsing the messages allows the tests to work for | 16 # literal string comparision. Parsing the messages allows the tests to work for |
| 642 self.assert_(not os.path.exists(os.environ['SENDMAILDEBUG'])) | 642 self.assert_(not os.path.exists(os.environ['SENDMAILDEBUG'])) |
| 643 | 643 |
| 644 def testNewUserAuthor(self): | 644 def testNewUserAuthor(self): |
| 645 # first without the permission | 645 # first without the permission |
| 646 # heh... just ignore the API for a second ;) | 646 # heh... just ignore the API for a second ;) |
| 647 self.db.security.role['Anonymous'].permissions=[] | 647 self.db.security.role['anonymous'].permissions=[] |
| 648 anonid = self.db.user.lookup('anonymous') | 648 anonid = self.db.user.lookup('anonymous') |
| 649 self.db.user.set(anonid, roles='Anonymous') | 649 self.db.user.set(anonid, roles='Anonymous') |
| 650 | 650 |
| 651 self.db.security.hasPermission('Email Registration', anonid) | 651 self.db.security.hasPermission('Email Registration', anonid) |
| 652 l = self.db.user.list() | 652 l = self.db.user.list() |
| 668 m.sort() | 668 m.sort() |
| 669 self.assertEqual(l, m) | 669 self.assertEqual(l, m) |
| 670 | 670 |
| 671 # now with the permission | 671 # now with the permission |
| 672 p = self.db.security.getPermission('Email Registration') | 672 p = self.db.security.getPermission('Email Registration') |
| 673 self.db.security.role['Anonymous'].permissions=[p] | 673 self.db.security.role['anonymous'].permissions=[p] |
| 674 handler = self.instance.MailGW(self.instance, self.db) | 674 handler = self.instance.MailGW(self.instance, self.db) |
| 675 handler.trapExceptions = 0 | 675 handler.trapExceptions = 0 |
| 676 message = cStringIO.StringIO(s) | 676 message = cStringIO.StringIO(s) |
| 677 handler.main(message) | 677 handler.main(message) |
| 678 m = self.db.user.list() | 678 m = self.db.user.list() |
