From: Kevin C. <ke...@us...> - 2005-09-28 15:53:34
|
Update of /cvsroot/mailmanager/mailmanager/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11192/tests Added Files: testZSQL.py Log Message: some regression tests for ways we are using ZSQL methods. Junk at present but this will get fleshed out a bit --- NEW FILE: testZSQL.py --- # # Workflow ZopeTestCase # # This is a higher level set of tests for the database test suite. These # operate against the python code in the MailManager core. This adds in # testing for potential bugs in the calling of the ZSQL methods for each # database platform. # # # $Id: testZSQL.py,v 1.1 2005/09/28 15:53:26 kevca Exp $ import os, sys if __name__ == '__main__': execfile(os.path.join(sys.path[0], 'framework.py')) from Testing import ZopeTestCase from Products.MailManager.tests.classes import testStructures from Products.MailManager.tests.classes import registry ZopeTestCase.installProduct('MailManager') import random import time import re import shutil import DocumentTemplate import DateTime from Shared.DC.ZRDB import sqlvar, sqltest, sqlgroup, Results import testDatabase from Testing import makerequest from Testing.ZopeTestCase import utils from Products import PlacelessTranslationService try: import MySQLdb from Products import ZMySQLDA except ImportError, e: pass try: import psycopg from Products import ZPsycopgDA except ImportError, e: pass class zsqlTest(testStructures.mailManagerTestCase): """ """ def zsqlTests(self): # res = self.mmobj.sql.zsqlDebug(REQUEST=self.request, requestval=1) # print res[0]['requestval'] # # res = self.mmobj.sql.zsqlDebug(REQUEST=self.request, hereval=1) # print res[0]['hereval'] res = self.mmobj.sql.zsqlDebug(sqlparams={'sqlparam' : 1})#, REQUEST=self.request) #print 'sqlparam', res[0]['sqlparam'] res = self.mmobj.sql.zsqlDebug(sqlvar='y') print 'sqlvar ', res[0] res = self.mmobj.sql.zsqlDebug() print 'sqlvar ', res[0] self.mmobj.sqlvar = 'x' res = self.mmobj.sql.zsqlDebug(sqlvar='y') print 'sqlvar ', res[0] res = self.mmobj.sql.zsqlDebug() print 'sqlvar ', res[0] #self.request.set('reqparam', 1) #res = self.mmobj.sql.zsqlDebug(REQUEST=self.request) #print 'reqparam', res[0]['reqparam'] class TestZSQL(zsqlTest): def testMySQL(self): self.dbplatform = 'mysql' self.runZSQLTests(self.dbplatform) def testPostgres(self): self.dbplatform = 'postgres' self.runZSQLTests(self.dbplatform) def runZSQLTests(self, dbplatform): if dbplatform in self.config['databases']['supported_databases']: self.sqlmethods = {} for sqlmethod in testDatabase.sqlmethods: self.sqlmethods[sqlmethod] = testDatabase.ZSQLFileMethod('%s.zsql' % sqlmethod, dbplatform='dbplatform') self.sqlmethods[sqlmethod].schema = self.config['database_%s' % dbplatform]['schema'] self.setupMailManager(dbplatform = dbplatform) #self.populateDataset() #self.populateTickets() #self.workflowTests() self.zsqlTests() self.removeMailManager() ########################################################################### def test_suite(): from unittest import TestSuite, makeSuite suite = TestSuite() suite.addTest(makeSuite(TestZSQL)) return suite if __name__ == '__main__': framework() |