This repository has been archived by the owner on Aug 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.py
63 lines (41 loc) · 1.54 KB
/
classes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: iso-8859-1 -*
##
## unittest Bases
## (c) Fry-IT, www.fry-it.com
## <peter@fry-it.com>
##
from Globals import SOFTWARE_HOME
from Testing import ZopeTestCase
ZopeTestCase.installProduct('FriedZopeBase')
#------------------------------------------------------------------------------
#
# Some constants
#
#------------------------------------------------------------------------------
# Open ZODB connection
app = ZopeTestCase.app()
# Set up sessioning objects
ZopeTestCase.utils.setupCoreSessions(app)
# Set up example applications
#if not hasattr(app, 'Examples'):
# ZopeTestCase.utils.importObjectFromFile(app, examples_path)
# Close ZODB connection
ZopeTestCase.close(app)
#------------------------------------------------------------------------------
class TestBase(ZopeTestCase.ZopeTestCase):
def dummy_redirect(self, *a, **kw):
self.has_redirected = a[0]
if kw:
print "*** Redirecting to %r + (%s)" % (a[0], kw)
else:
print "*** Redirecting to %r" % a[0]
def afterSetUp(self):
#dispatcher = self.folder.manage_addProduct['MExpenses']
#dispatcher.manage_addHomepage('mexpenses')
#self.mexpenses = self.folder['mexpenses']
#self.mexpenses.http_redirect = self.dummy_redirect
self.has_redirected = False
def _prepareSessionManager():
request = self.app.REQUEST
sdm = self.app.session_data_manager
request.set('SESSION', sdm.getSessionData())