Here is the beginning of a unittest that we have been using.  I should move this up to a parent class.  Otherwise it needs to be in each unittest --

class DummyResponse:
    def __init__(self):
        self.headerMap = {}
        self.simpleCookie = Cookie.SimpleCookie()
        self.version = "1.1"

    def purge__(self):
        pass

class DummyRequest:
    def __init__(self):
        self.approot = "/"
        self.headerMap = {}
        self.browserUrl = "http://testap/"
        self.simpleCookie = Cookie.SimpleCookie()
    def purge__(self):
        pass


oldrequest = None
oldresponse = None

class QDBInterfaceTest(unittest.TestCase):

    def setUp(self):
        global oldrequest
        global oldresponse
        cherrypy.config.update(file="../dev.cfg")
        cherrypy.response = DummyResponse()
        cherrypy.request = DummyRequest()

    def tearDown(self):
        cherrypy.request = oldrequest
        cherrypy.response = oldresponse


On 12/2/05, programmer.py <[EMAIL PROTECTED]> wrote:

Thanks! I swear one day I'll learn to check the trac before bugging the
list!

jw


Reply via email to