Parent: [a65bcc] (diff)

Child: [84a7c2] (diff)

Download this file

__init__.py    51 lines (36 with data), 1.6 kB

 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
from os import path, environ
from tg import config
from paste.deploy import loadapp
from webtest import TestApp
from pyforge.tests import helpers
def run_app_setup():
test_config = environ.get('SANDBOX') and 'sandbox-test.ini' or 'test.ini'
conf_dir = config.here = path.abspath(
path.dirname(__file__) + '/../..')
test_file = path.join(conf_dir, test_config)
helpers.setup_basic_test(test_file)
# cmd = SetupCommand('setup-app')
# cmd.run([test_file])
return test_config, conf_dir
class TestController(object):
"""
Base functional test case for the controllers.
The pyforge application instance (``self.app``) set up in this test
case (and descendants) has authentication disabled, so that developers can
test the protected areas independently of the :mod:`repoze.who` plugins
used initially. This way, authentication can be tested once and separately.
Check pyforge.tests.functional.test_authentication for the repoze.who
integration tests.
This is the officially supported way to test protected areas with
repoze.who-testutil (http://code.gustavonarea.net/repoze.who-testutil/).
"""
application_under_test = 'main'
def setUp(self):
"""Method called by nose before running each test"""
test_config, conf_dir = run_app_setup()
wsgiapp = loadapp('config:%s#%s' % (test_config, self.application_under_test),
relative_to=conf_dir)
self.app = TestApp(wsgiapp)
def tearDown(self):
"""Method called by nose after running each test"""
pass