Mercurial > kallithea
annotate pylons_app/tests/__init__.py @ 463:a03250279b15
test for register page
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Mon, 06 Sep 2010 00:34:23 +0200 |
parents | 7c978511c951 |
children | cbe777be5b8c |
rev | line source |
---|---|
0 | 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 config, url | |
15 from routes.util import URLGenerator | |
16 from webtest import TestApp | |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
17 import os |
463
a03250279b15
test for register page
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
18 from pylons_app.model import meta |
0 | 19 import pylons.test |
20 | |
21 __all__ = ['environ', 'url', 'TestController'] | |
22 | |
23 # Invoke websetup with the current config file | |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
24 SetupCommand('setup-app').run([pylons.test.pylonsapp.config['__file__']]) |
0 | 25 |
26 environ = {} | |
27 | |
28 class TestController(TestCase): | |
29 | |
30 def __init__(self, *args, **kwargs): | |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
31 wsgiapp = pylons.test.pylonsapp |
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
32 config = wsgiapp.config |
0 | 33 self.app = TestApp(wsgiapp) |
34 url._push_object(URLGenerator(config['routes.map'], environ)) | |
463
a03250279b15
test for register page
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
35 self.sa = meta.Session |
0 | 36 TestCase.__init__(self, *args, **kwargs) |
459
7c978511c951
implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents:
0
diff
changeset
|
37 |