コード例 #1
0
    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})
コード例 #2
0
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})
コード例 #3
0
ファイル: test_visit.py プロジェクト: OnShift/turbogears
 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
コード例 #4
0
ファイル: test_visit.py プロジェクト: timmartin19/turbogears
 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
コード例 #5
0
ファイル: test_identity.py プロジェクト: thraxil/gtreed
 def tearDown(self):
     testutil.DBTest.tearDown(self)
     startup.stopTurboGears()
     cherrypy.request.identityProvider = self._provider
     config.update({'identity.on': self._identity_on})
コード例 #6
0
ファイル: test_identity.py プロジェクト: thraxil/gtreed
 def tearDown(self):
     startup.stopTurboGears()
     config.update(self._original_config)
コード例 #7
0
ファイル: test_visit.py プロジェクト: timmartin19/turbogears
 def tearDown(self):
     startup.stopTurboGears()
     config.update({'visit.timeout': self._visit_timeout})
     config.update({'visit.on': self._visit_on})
コード例 #8
0
ファイル: test_model.py プロジェクト: mightymau/hubspace
 def tearDown(self):
     startup.stopTurboGears()
     pass
コード例 #9
0
 def tearDown(self):
     testutil.DBTest.tearDown(self)
     startup.stopTurboGears()
     cherrypy.request.identityProvider = self._provider
     config.update({'identity.on': self._identity_on})
コード例 #10
0
 def tearDown(self):
     startup.stopTurboGears()
     config.update(self._original_config)
コード例 #11
0
ファイル: test_visit.py プロジェクト: OnShift/turbogears
 def tearDown(self):
     startup.stopTurboGears()
     config.update({'visit.timeout': self._visit_timeout})
     config.update({'visit.on': self._visit_on})