Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg-security/TI12-security/trunk/NDGSecurity/python/ndg_security_test/ndg/security/test/integration/pylonsapp/pylonsapp/tests/__init__.py@7077
Revision 7077,
1018 bytes
checked in by pjkersha, 11 years ago
(diff) |
|
-
Property svn:keywords set to
Id
|
Line | |
---|
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.script.appinstall import SetupCommand |
---|
14 | from pylons import url |
---|
15 | from routes.util import URLGenerator |
---|
16 | from webtest import TestApp |
---|
17 | |
---|
18 | import pylons.test |
---|
19 | |
---|
20 | __all__ = ['environ', 'url', 'TestController'] |
---|
21 | |
---|
22 | # Invoke websetup with the current config file |
---|
23 | SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']]) |
---|
24 | |
---|
25 | environ = {} |
---|
26 | |
---|
27 | class TestController(TestCase): |
---|
28 | |
---|
29 | def __init__(self, *args, **kwargs): |
---|
30 | wsgiapp = pylons.test.pylonsapp |
---|
31 | config = wsgiapp.config |
---|
32 | self.app = TestApp(wsgiapp) |
---|
33 | url._push_object(URLGenerator(config['routes.map'], environ)) |
---|
34 | TestCase.__init__(self, *args, **kwargs) |
---|
Note: See
TracBrowser
for help on using the repository browser.