Jan Dittberner
683f2ff4ef
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@155 a67ec6bc-e5d5-0310-a910-815c51eb3124
50 lines
No EOL
1,020 B
Python
50 lines
No EOL
1,020 B
Python
#!/usr/bin/env python
|
|
import unittest
|
|
import psycopg
|
|
|
|
class TestDBConnection(unittest.TestCase):
|
|
def setUp(self):
|
|
"""
|
|
set up database connection used in tests
|
|
"""
|
|
self.cnx = psycopg.connect("host=localhost user=gnuviech password=SIKKnsyXsV5yU dbname=gnuviechadmin")
|
|
self.cr = self.cnx.cursor()
|
|
|
|
def testSelectMailAliases(self):
|
|
"""
|
|
select all mail aliases
|
|
"""
|
|
self.cr.execute('SELECT * FROM mailalias')
|
|
self.cnx.commit()
|
|
|
|
print self.cr.description
|
|
|
|
result = self.cr.fetchall()
|
|
for line in result:
|
|
print line
|
|
|
|
def testSelectMailPasswd(self):
|
|
"""
|
|
select all mail passwords
|
|
"""
|
|
self.cr.execute('SELECT * FROM mailpasswd')
|
|
self.cnx.commit()
|
|
|
|
print self.cr.description
|
|
|
|
result = cr.fetchall()
|
|
for line in result:
|
|
print line
|
|
|
|
def testSelectDomains(self):
|
|
"""
|
|
select all domains
|
|
"""
|
|
self.cr.execute('SELECT DISTINCT domain FROM mailalias')
|
|
self.cnx.commit()
|
|
|
|
print self.cr.description
|
|
|
|
result = cr.fetchall()
|
|
for line in result:
|
|
print line |