]> asedeno.scripts.mit.edu Git - bluechips.git/blob - bluechips/tests/__init__.py
Create Pylons app
[bluechips.git] / bluechips / tests / __init__.py
1 """Pylons application test package
2
3 This package assumes the Pylons environment is already loaded, such as
4 when this script is imported from the `nosetests --with-pylons=test.ini`
5 command.
6
7 This module initializes the application via ``websetup`` (`paster
8 setup-app`) and provides the base testing objects.
9 """
10 from unittest import TestCase
11
12 from paste.deploy import loadapp
13 from paste.fixture import TestApp
14 from paste.script.appinstall import SetupCommand
15 from pylons import config
16 from routes import url_for
17
18 __all__ = ['url_for', 'TestController']
19
20 # Invoke websetup with the current config file
21 SetupCommand('setup-app').run([config['__file__']])
22
23 class TestController(TestCase):
24
25     def __init__(self, *args, **kwargs):
26         wsgiapp = loadapp('config:%s' % config['__file__'])
27         self.app = TestApp(wsgiapp)
28         TestCase.__init__(self, *args, **kwargs)