comparison test/test_mailgw.py @ 908:a8d80ffe37cc

Removed the unnecessary volatiledb and the related complications. Security much simpler and self-contained now.
author Richard Jones <richard@users.sourceforge.net>
date Mon, 29 Jul 2002 00:56:06 +0000
parents 502a5ae11cc5
children 04a6b3bfbf23
comparison
equal deleted inserted replaced
907:38a74d1351c5 908:a8d80ffe37cc
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.24 2002-07-26 08:27:00 richard Exp $ 11 # $Id: test_mailgw.py,v 1.25 2002-07-29 00:56:06 richard 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
631 # NO NOSY MESSAGE SHOULD BE SENT! 631 # NO NOSY MESSAGE SHOULD BE SENT!
632 self.assert_(not os.path.exists(os.environ['SENDMAILDEBUG'])) 632 self.assert_(not os.path.exists(os.environ['SENDMAILDEBUG']))
633 633
634 def testNewUserAuthor(self): 634 def testNewUserAuthor(self):
635 # first without the permission 635 # first without the permission
636 Anonid = self.db.role.lookup('Anonymous') 636 # heh... just ignore the API for a second ;)
637 self.db.role.set(Anonid, permissions=[]) 637 self.db.security.role['Anonymous'].permissions=[]
638 anonid = self.db.user.lookup('anonymous') 638 anonid = self.db.user.lookup('anonymous')
639 self.db.user.set(anonid, roles='Anonymous') 639 self.db.user.set(anonid, roles='Anonymous')
640 640
641 self.db.security.hasPermission('Email Registration', anonid) 641 self.db.security.hasPermission('Email Registration', anonid)
642 l = self.db.user.list() 642 l = self.db.user.list()
658 m.sort() 658 m.sort()
659 self.assertEqual(l, m) 659 self.assertEqual(l, m)
660 660
661 # now with the permission 661 # now with the permission
662 p = self.db.security.getPermission('Email Registration') 662 p = self.db.security.getPermission('Email Registration')
663 self.db.role.set(Anonid, permissions=[p]) 663 self.db.security.role['Anonymous'].permissions=[p]
664 handler = self.instance.MailGW(self.instance, self.db) 664 handler = self.instance.MailGW(self.instance, self.db)
665 handler.trapExceptions = 0 665 handler.trapExceptions = 0
666 message = cStringIO.StringIO(s) 666 message = cStringIO.StringIO(s)
667 handler.main(message) 667 handler.main(message)
668 m = self.db.user.list() 668 m = self.db.user.list()
779 return unittest.TestSuite(l) 779 return unittest.TestSuite(l)
780 780
781 781
782 # 782 #
783 # $Log: not supported by cvs2svn $ 783 # $Log: not supported by cvs2svn $
784 # Revision 1.24 2002/07/26 08:27:00 richard
785 # Very close now. The cgi and mailgw now use the new security API. The two
786 # templates have been migrated to that setup. Lots of unit tests. Still some
787 # issue in the web form for editing Roles assigned to users.
788 #
784 # Revision 1.23 2002/07/14 02:02:43 richard 789 # Revision 1.23 2002/07/14 02:02:43 richard
785 # Fixed the unit tests for the new multilist controls in the mailgw 790 # Fixed the unit tests for the new multilist controls in the mailgw
786 # 791 #
787 # Revision 1.22 2002/07/09 01:21:24 richard 792 # Revision 1.22 2002/07/09 01:21:24 richard
788 # Added ability for unit tests to turn off exception handling in mailgw so 793 # Added ability for unit tests to turn off exception handling in mailgw so

Roundup Issue Tracker: http://roundup-tracker.org/