comparison test/test_htmltemplate.py @ 905:502a5ae11cc5

Very close now. The cgi and mailgw now use the new security API. The two templates have been migrated to that setup. Lots of unit tests. Still some issue in the web form for editing Roles assigned to users.
author Richard Jones <richard@users.sourceforge.net>
date Fri, 26 Jul 2002 08:27:00 +0000
parents b0d3d3535998
children fdcf16b444a9
comparison
equal deleted inserted replaced
904:02763530b9e8 905:502a5ae11cc5
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_htmltemplate.py,v 1.18 2002-07-25 07:14:06 richard Exp $ 11 # $Id: test_htmltemplate.py,v 1.19 2002-07-26 08:27:00 richard Exp $
12 12
13 import unittest, cgi, time, os, shutil 13 import unittest, cgi, time, os, shutil
14 14
15 from roundup import date, password 15 from roundup import date, password
16 from roundup.htmltemplate import TemplateFunctions, IndexTemplate, ItemTemplate 16 from roundup.htmltemplate import TemplateFunctions, IndexTemplate, ItemTemplate
432 client.instance = None 432 client.instance = None
433 self.tf = tf = IndexTemplate(client, '', 'issue') 433 self.tf = tf = IndexTemplate(client, '', 'issue')
434 tf.props = ['title'] 434 tf.props = ['title']
435 435
436 # admin user 436 # admin user
437 r = str(self.db.role.lookup('Admin')) 437 self.db.user.create(username="admin", roles='Admin')
438 self.db.user.create(username="admin", roles=[r]) 438 self.db.user.create(username="anonymous", roles='User')
439 r = str(self.db.role.lookup('User'))
440 self.db.user.create(username="anonymous", roles=[r])
441 439
442 def testBasic(self): 440 def testBasic(self):
443 self.assertEqual(self.tf.execute_template('hello'), 'hello') 441 self.assertEqual(self.tf.execute_template('hello'), 'hello')
444 442
445 def testValue(self): 443 def testValue(self):
501 client.instance = None 499 client.instance = None
502 self.tf = tf = IndexTemplate(client, '', 'issue') 500 self.tf = tf = IndexTemplate(client, '', 'issue')
503 tf.nodeid = self.db.issue.create(title="spam", status='1') 501 tf.nodeid = self.db.issue.create(title="spam", status='1')
504 502
505 # admin user 503 # admin user
506 r = str(self.db.role.lookup('Admin')) 504 self.db.user.create(username="admin", roles='Admin')
507 self.db.user.create(username="admin", roles=[r]) 505 self.db.user.create(username="anonymous", roles='User')
508 r = str(self.db.role.lookup('User'))
509 self.db.user.create(username="anonymous", roles=[r])
510 506
511 def testBasic(self): 507 def testBasic(self):
512 self.assertEqual(self.tf.execute_template('hello'), 'hello') 508 self.assertEqual(self.tf.execute_template('hello'), 'hello')
513 509
514 def testValue(self): 510 def testValue(self):
547 ]) 543 ])
548 544
549 545
550 # 546 #
551 # $Log: not supported by cvs2svn $ 547 # $Log: not supported by cvs2svn $
548 # Revision 1.18 2002/07/25 07:14:06 richard
549 # Bugger it. Here's the current shape of the new security implementation.
550 # Still to do:
551 # . call the security funcs from cgi and mailgw
552 # . change shipped templates to include correct initialisation and remove
553 # the old config vars
554 # ... that seems like a lot. The bulk of the work has been done though. Honest :)
555 #
552 # Revision 1.17 2002/07/18 23:07:07 richard 556 # Revision 1.17 2002/07/18 23:07:07 richard
553 # Unit tests and a few fixes. 557 # Unit tests and a few fixes.
554 # 558 #
555 # Revision 1.16 2002/07/09 05:20:09 richard 559 # Revision 1.16 2002/07/09 05:20:09 richard
556 # . added email display function - mangles email addrs so they're not so easily 560 # . added email display function - mangles email addrs so they're not so easily

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