|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: test_db.py,v 1.52 2002-09-20 05:08:00 richard Exp $ |
| 18 | +# $Id: test_db.py,v 1.53 2002-09-20 19:26:28 gmcm Exp $ |
19 | 19 |
|
20 | 20 | import unittest, os, shutil, time |
21 | 21 |
|
@@ -314,35 +314,35 @@ def testExceptions(self): |
314 | 314 | # class get |
315 | 315 | # |
316 | 316 | # invalid node id |
317 | | - ar(IndexError, self.db.issue.get, '1', 'title') |
| 317 | + ar(IndexError, self.db.issue.get, '99', 'title') |
318 | 318 | # invalid property name |
319 | 319 | ar(KeyError, self.db.status.get, '2', 'foo') |
320 | 320 |
|
321 | 321 | # |
322 | 322 | # class set |
323 | 323 | # |
324 | 324 | # invalid node id |
325 | | - ar(IndexError, self.db.issue.set, '1', title='foo') |
| 325 | + ar(IndexError, self.db.issue.set, '99', title='foo') |
326 | 326 | # invalid property name |
327 | 327 | ar(KeyError, self.db.status.set, '1', foo='foo') |
328 | 328 | # string property |
329 | 329 | ar(TypeError, self.db.status.set, '1', name=1) |
330 | 330 | # key name clash |
331 | 331 | ar(ValueError, self.db.status.set, '2', name='unread') |
332 | 332 | # set up a valid issue for me to work on |
333 | | - self.db.issue.create(title="spam", status='1') |
| 333 | + id = self.db.issue.create(title="spam", status='1') |
334 | 334 | # invalid link index |
335 | | - ar(IndexError, self.db.issue.set, '6', title='foo', status='bar') |
| 335 | + ar(IndexError, self.db.issue.set, id, title='foo', status='bar') |
336 | 336 | # invalid link value |
337 | | - ar(ValueError, self.db.issue.set, '6', title='foo', status=1) |
| 337 | + ar(ValueError, self.db.issue.set, id, title='foo', status=1) |
338 | 338 | # invalid multilink type |
339 | | - ar(TypeError, self.db.issue.set, '6', title='foo', status='1', |
| 339 | + ar(TypeError, self.db.issue.set, id, title='foo', status='1', |
340 | 340 | nosy='hello') |
341 | 341 | # invalid multilink index type |
342 | | - ar(ValueError, self.db.issue.set, '6', title='foo', status='1', |
| 342 | + ar(ValueError, self.db.issue.set, id, title='foo', status='1', |
343 | 343 | nosy=[1]) |
344 | 344 | # invalid multilink index |
345 | | - ar(IndexError, self.db.issue.set, '6', title='foo', status='1', |
| 345 | + ar(IndexError, self.db.issue.set, id, title='foo', status='1', |
346 | 346 | nosy=['10']) |
347 | 347 | # invalid number value |
348 | 348 | ar(TypeError, self.db.user.create, username='foo', age='a') |
@@ -422,22 +422,23 @@ def testJournals(self): |
422 | 422 | self.assertNotEqual(date_stamp, date_stamp2) |
423 | 423 |
|
424 | 424 | def testPack(self): |
425 | | - self.db.issue.create(title="spam", status='1') |
| 425 | + id = self.db.issue.create(title="spam", status='1') |
426 | 426 | self.db.commit() |
427 | | - self.db.issue.set('1', status='2') |
| 427 | + self.db.issue.set(id, status='2') |
428 | 428 | self.db.commit() |
429 | 429 |
|
430 | 430 | # sleep for at least a second, then get a date to pack at |
431 | 431 | time.sleep(1) |
432 | 432 | pack_before = date.Date('.') |
| 433 | + time.sleep(1) |
433 | 434 |
|
434 | 435 | # one more entry |
435 | | - self.db.issue.set('1', status='3') |
| 436 | + self.db.issue.set(id, status='3') |
436 | 437 | self.db.commit() |
437 | 438 |
|
438 | 439 | # pack |
439 | 440 | self.db.pack(pack_before) |
440 | | - journal = self.db.getjournal('issue', '1') |
| 441 | + journal = self.db.getjournal('issue', id) |
441 | 442 |
|
442 | 443 | # we should have the create and last set entries now |
443 | 444 | self.assertEqual(2, len(journal)) |
|
0 commit comments