Mercurial > p > roundup > code
comparison test/db_test_base.py @ 1955:b00ad075bb2f
more unit tests, fixes and cleanups
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 10 Dec 2003 01:40:51 +0000 |
| parents | 767ff2a03eee |
| children | 910b39f8c5b8 |
comparison
equal
deleted
inserted
replaced
| 1954:a71bc3a6f433 | 1955:b00ad075bb2f |
|---|---|
| 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.11 2003-12-05 09:47:46 richard Exp $ | 18 # $Id: db_test_base.py,v 1.12 2003-12-10 01:40:51 richard 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 |
| 693 {'username': 'blop'}, | 693 {'username': 'blop'}, |
| 694 {'username': 'blorp'}): | 694 {'username': 'blorp'}): |
| 695 self.db.user.create(**user) | 695 self.db.user.create(**user) |
| 696 iss = self.db.issue | 696 iss = self.db.issue |
| 697 for issue in ( | 697 for issue in ( |
| 698 {'title': 'issue one', 'status': '2', | 698 {'title': 'issue one', 'status': '2', 'assignedto': '1', |
| 699 'foo': date.Interval('1:10'), | 699 'foo': date.Interval('1:10'), |
| 700 'deadline': date.Date('2003-01-01.00:00')}, | 700 'deadline': date.Date('2003-01-01.00:00')}, |
| 701 {'title': 'issue two', 'status': '1', | 701 {'title': 'issue two', 'status': '1', 'assignedto': '2', |
| 702 'foo': date.Interval('1d'), | 702 'foo': date.Interval('1d'), |
| 703 'deadline': date.Date('2003-02-16.22:50')}, | 703 'deadline': date.Date('2003-02-16.22:50')}, |
| 704 {'title': 'issue three', 'status': '1', | 704 {'title': 'issue three', 'status': '1', |
| 705 'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')}, | 705 'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')}, |
| 706 {'title': 'non four', 'status': '3', | 706 {'title': 'non four', 'status': '3', |
| 723 ['1', '2']) | 723 ['1', '2']) |
| 724 | 724 |
| 725 def testFilteringLink(self): | 725 def testFilteringLink(self): |
| 726 ae, filt = self.filteringSetup() | 726 ae, filt = self.filteringSetup() |
| 727 ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['2','3']) | 727 ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['2','3']) |
| 728 ae(filt(None, {'assignedto': '-1'}, ('+','id'), (None,None)), ['3','4']) | |
| 728 | 729 |
| 729 def testFilteringRetired(self): | 730 def testFilteringRetired(self): |
| 730 ae, filt = self.filteringSetup() | 731 ae, filt = self.filteringSetup() |
| 731 self.db.issue.retire('2') | 732 self.db.issue.retire('2') |
| 732 ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['3']) | 733 ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['3']) |
