comparison test/db_test_base.py @ 2753:d8eb00a54119

safeget() removed from the API
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Thu, 14 Oct 2004 10:39:14 +0000
parents 93e2e5b55a3c
children 1f89984c0ea5
comparison
equal deleted inserted replaced
2750:a97bbd72a643 2753:d8eb00a54119
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: db_test_base.py,v 1.48 2004-10-08 00:18:28 richard Exp $ 18 # $Id: db_test_base.py,v 1.49 2004-10-14 10:39:14 a1s Exp $
19 19
20 import unittest, os, shutil, errno, imp, sys, time, pprint 20 import unittest, os, shutil, errno, imp, sys, time, pprint
21 21
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23 Interval, DatabaseError, Boolean, Number, Node 23 Interval, DatabaseError, Boolean, Number, Node
1060 # make sure id counters are set correctly 1060 # make sure id counters are set correctly
1061 maxid = max([int(id) for id in self.db.user.list()]) 1061 maxid = max([int(id) for id in self.db.user.list()])
1062 newid = self.db.user.create(username='testing') 1062 newid = self.db.user.create(username='testing')
1063 assert newid > maxid 1063 assert newid > maxid
1064 1064
1065 def testSafeGet(self):
1066 # existent nodeid, existent property
1067 self.assertEqual(self.db.user.safeget('1', 'username'), 'admin')
1068 # nonexistent nodeid, existent property
1069 self.assertEqual(self.db.user.safeget('999', 'username'), None)
1070 # different default
1071 self.assertEqual(self.db.issue.safeget('999', 'nosy', []), [])
1072
1073 def testAddProperty(self): 1065 def testAddProperty(self):
1074 self.db.issue.create(title="spam", status='1') 1066 self.db.issue.create(title="spam", status='1')
1075 self.db.commit() 1067 self.db.commit()
1076 1068
1077 self.db.issue.addprop(fixer=Link("user")) 1069 self.db.issue.addprop(fixer=Link("user"))

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