Removed account model and back with user model.
[TownSquare.git] / townsquare / tests / __init__.py
blobd51f6f265400de46139e1fb3e983ff5648842fc1
1 """Pylons application test package
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.
7 This module initializes the application via ``websetup`` (`paster
8 setup-app`) and provides the base testing objects.
9 """
10 from unittest import TestCase
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
18 import pylons.test
20 __all__ = ['environ', 'url', 'TestController']
22 # Invoke websetup with the current config file
23 SetupCommand('setup-app').run([config['__file__']])
25 environ = {}
27 class TestController(TestCase):
29 def __init__(self, *args, **kwargs):
30 if pylons.test.pylonsapp:
31 wsgiapp = pylons.test.pylonsapp
32 else:
33 wsgiapp = loadapp('config:%s' % config['__file__'])
34 self.app = TestApp(wsgiapp)
35 url._push_object(URLGenerator(config['routes.map'], environ))
36 TestCase.__init__(self, *args, **kwargs)