Ilja Booij wrote:
Paul J Stevens wrote:

First bug found with the testsuite I'm building using python (unittest+imaputil).

Strange... I haven't succeeded in reproducing this error.

Somehow an mboxid of 0 was returned instead of an mboxid of > 0

Indeed. And if I do a 'setacl "testaclbox" "testuser1" "slrw" ' in stead of a "slraw", I get a segfault.


SELECT mbx.name, mbx.mailbox_idnr, mbx.owner_idnr FROM
mailboxes mbx LEFT JOIN acl ON mbx.mailbox_idnr = acl.mailbox_id WHERE
(acl.user_id = '14' AND acl.lookup_flag = '1') OR mbx.owner_idnr = '14'

The result was clean.


and check what the output is?

I'm currently at a loss here, especially since I cannot reproduce the problem.

I'm attaching the test-script. Create two users:

dbmail-adduser a testuser1 '{md5:}test' 0 0 [EMAIL PROTECTED]
dbmail-adduser a testuser2 '{md5:}test' 0 0 [EMAIL PROTECTED]

on host 'mail' and run....



--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl
#!/usr/bin/python

import unittest, imaplib
import traceback

class testDbmailImap(unittest.TestCase):

    def setUp(self):
        self.o = imaplib.IMAP4('mail')
        self.o.debug = 4
        self.assertEquals(self.o.login('testuser1','test'),('OK',['LOGIN completed']))

    def testCreate(self):
        self.assertEquals(self.o.create('testbox'),('OK',['CREATE completed']))

    def testDelete(self):
        self.o.create('testdelete')
        self.assertEquals(self.o.delete('testdelete'),('OK',['DELETE completed']))

    def testList(self):
        dirlist=['dir1','dir1/sub1','dir2/sub2','dir2/sub 2a','dir3/sub 3/ssub1','dir3/sub 3/.ssub2']
        for d in dirlist: self.o.create(d)
        try:    
            self.assertEquals(self.o.list('"dir1"')[0],'OK')
        except: 
            traceback.print_exc()
            
        try:
            self.assertEquals(self.o.list('"dir2"')[0],'OK')
        except:
            traceback.print_exc()

        try:
            self.assertEquals(self.o.list('"dir3"')[0],'OK')
        except:
            traceback.print_exc()
            
        for d in dirlist: self.o.delete(d)

    def testSetacl(self):
        self.o.create('testaclbox')
        self.o.setacl('testaclbox','testuser2','slrw')

        p = imaplib.IMAP4('mail')
        p.debug = 4
        p.login('testuser2','test')
        p.create('testbox')
        try:
            print p.list()
        except:
            traceback.print_exc()

        p.delete('testbox')

        self.o.delete('testaclbox')

    def testGetacl(self):
        self.assertEquals(self.o.getacl('INBOX'),('OK', ['"INBOX" testuser1 lrswipcda ']))

    def tearDown(self):
        try:
            self.o.delete('testbox')
            self.o.logout()
        except:
            pass


if __name__=='__main__': unittest.main()

        

Reply via email to