Roundup Tracker - Issues

Message4843

Author tekberg
Recipients admin, ber, tekberg
Date 2013-04-12.15:14:43
Message-id <1365779684.02.0.736046802699.issue2550805@psf.upfronthosting.co.za>
In-reply-to
I am having trouble writing tests that fail for Postgres. I put these 
two functions in in test/db_test_base.py in the DBTest class:

    def testStringFindCase(self):
        self.assertRaises(TypeError, self.db.issue.stringFind, 
status='1')

        ids = []
        ids.append(self.db.issue.create(title="SPAM"))
        self.db.issue.create(title="not spam")
        ids.append(self.db.issue.create(title="spam"))
        ids.sort()
        got = self.db.issue.stringFind(title='spam')
        got.sort()
        self.assertEqual(got, ids)
        self.assertEqual(self.db.issue.stringFind(title='fubar'), [])

    def testReindexingChangeCase(self):
        search = self.db.indexer.search
        issue = self.db.issue
        i1 = issue.create(title="FLEBBLE plop")
        i2 = issue.create(title="FLEBBLE frooz")
        self.db.commit()
        self.assertEquals(search(['plop'], issue), {i1: {}})
        self.assertEquals(search(['flebble'], issue), {i1: {}, i2: {}})

        # change i1's title
        issue.set(i1, title="plop")
        self.db.commit()
        self.assertEquals(search(['plop'], issue), {i1: {}})
        self.assertEquals(search(['flebble'], issue), {i2: {}})

Then I ran these commands - all 4 databases passed.

$ python run_test.py . '^testStringFindCase$'
testStringFindCase (test.test_anydbm.anydbmDBTest) ... ok
testStringFindCase (test.test_memorydb.memorydbDBTest) ... ok
testStringFindCase (test.test_postgresql.postgresqlDBTest) ... ok
testStringFindCase (test.test_sqlite.sqliteDBTest) ... ok
$ python run_test.py . '^testReindexingChangeCase$'
testReindexingChangeCase (test.test_anydbm.anydbmDBTest) ... ok
testReindexingChangeCase (test.test_memorydb.memorydbDBTest) ... ok
testReindexingChangeCase (test.test_postgresql.postgresqlDBTest) ... ok
testReindexingChangeCase (test.test_sqlite.sqliteDBTest) ... ok

I expected Postgres to fail on at least one of these.

Obviously I don't know enough about the issue search on title to 
formulate a test for the postgres failure case.

Can someone point me to the code that implements the issue title search?
History
Date User Action Args
2013-04-12 15:14:44tekbergsetmessageid: <1365779684.02.0.736046802699.issue2550805@psf.upfronthosting.co.za>
2013-04-12 15:14:44tekbergsetrecipients: + tekberg, admin, ber
2013-04-12 15:14:44tekberglinkissue2550805 messages
2013-04-12 15:14:43tekbergcreate