comparison test/db_test_base.py @ 1986:910b39f8c5b8

use the upload-supplied content-type if there is one
author Richard Jones <richard@users.sourceforge.net>
date Tue, 20 Jan 2004 03:58:38 +0000
parents b00ad075bb2f
children 5660b89f8903
comparison
equal deleted inserted replaced
1985:95623e250b01 1986:910b39f8c5b8
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.12 2003-12-10 01:40:51 richard Exp $ 18 # $Id: db_test_base.py,v 1.13 2004-01-20 03:58:38 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
578 self.db.pack(pack_before) 578 self.db.pack(pack_before)
579 579
580 # we should have the create and last set entries now 580 # we should have the create and last set entries now
581 self.assertEqual(jlen-1, len(self.db.getjournal('issue', id))) 581 self.assertEqual(jlen-1, len(self.db.getjournal('issue', id)))
582 582
583 def testSearching(self): 583 def testIndexerSearching(self):
584 self.db.file.create(content='hello', type="text/plain") 584 f1 = self.db.file.create(content='hello', type="text/plain")
585 self.db.file.create(content='world', type="text/frozz", 585 f2 = self.db.file.create(content='world', type="text/frozz",
586 comment='blah blah') 586 comment='blah blah')
587 self.db.issue.create(files=['1', '2'], title="flebble plop") 587 i1 = self.db.issue.create(files=[f1, f2], title="flebble plop")
588 self.db.issue.create(title="flebble frooz") 588 i2 = self.db.issue.create(title="flebble frooz")
589 self.db.commit() 589 self.db.commit()
590 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue), 590 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue),
591 {'1': {'files': ['1']}}) 591 {i1: {'files': [f1]}})
592 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) 592 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {})
593 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), 593 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),
594 {'2': {}}) 594 {i2: {}})
595 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), 595 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue),
596 {'2': {}, '1': {}}) 596 {i1: {}, i2: {}})
597 597
598 def testReindexing(self): 598 def testReindexing(self):
599 self.db.issue.create(title="frooz") 599 self.db.issue.create(title="frooz")
600 self.db.commit() 600 self.db.commit()
601 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), 601 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue),

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