def tearDown(self): # implementation copied from turbogears.testutil.stop_server. # The only change is that cherrypy.root is set to None # AFTER stopTurbogears has been called so that wsmeext.tg11 # can correctly uninstall its filter. if config.get("cp_started"): cherrypy.server.stop() config.update({"cp_started": False}) if config.get("server_started"): startup.stopTurboGears() config.update({"server_started": False})
def stop_server(tg_only=False): """Stop the server and unmount the application. Use tg_only=True to leave CherryPy running (for faster tests). """ unmount() if config.get("cp_started") and not tg_only: cherrypy.server.stop() config.update({"cp_started" : False}) if config.get("server_started"): startup.stopTurboGears() config.update({"server_started" : False})
def test_cookie_permanent(self): """Check that the visit cookie can be made permanent.""" permanent = config.get('visit.cookie.permanent', False) try: # set cookie permanent for this test only (needs restart) startup.stopTurboGears() config.update({'visit.cookie.permanent': True}) startup.startTurboGears() testutil.create_request('/') morsel = cherrypy.response.simple_cookie[self.cookie_name] finally: config.update({'visit.cookie.permanent': permanent}) assert morsel['max-age'] == 3000 expires = time.mktime(time.strptime(morsel['expires'], '%a, %d-%b-%Y %H:%M:%S GMT')[:8] + (0,)) should_expire = time.mktime(time.gmtime()) + morsel['max-age'] assert abs(should_expire - expires) < 3
def test_cookie_permanent(self): """Check that the visit cookie can be made permanent.""" permanent = config.get('visit.cookie.permanent', False) try: # set cookie permanent for this test only (needs restart) startup.stopTurboGears() config.update({'visit.cookie.permanent': True}) startup.startTurboGears() testutil.create_request('/') morsel = cherrypy.response.simple_cookie[self.cookie_name] finally: config.update({'visit.cookie.permanent': permanent}) assert morsel['max-age'] == 3000 expires = time.mktime( time.strptime(morsel['expires'], '%a, %d-%b-%Y %H:%M:%S GMT')[:8] + (0, )) should_expire = time.mktime(time.gmtime()) + morsel['max-age'] assert abs(should_expire - expires) < 3
def tearDown(self): testutil.DBTest.tearDown(self) startup.stopTurboGears() cherrypy.request.identityProvider = self._provider config.update({'identity.on': self._identity_on})
def tearDown(self): startup.stopTurboGears() config.update(self._original_config)
def tearDown(self): startup.stopTurboGears() config.update({'visit.timeout': self._visit_timeout}) config.update({'visit.on': self._visit_on})
def tearDown(self): startup.stopTurboGears() pass