def setUp(): g._push_object(Globals()) c._push_object(mock.Mock()) request._push_object(Request.blank('/')) ThreadLocalORMSession.close_all() M.EmailAddress.query.remove({}) M.OpenIdNonce.query.remove({}) M.OpenIdAssociation.query.remove({})
def setUp(): g._push_object(Globals()) c._push_object(mock.Mock()) c.user._id = None c.project = mock.Mock() c.project.name = 'Test Project' c.project.shortname = 'tp' c.project._id = 'testproject/' c.project.database_uri = 'mim://nosetest:project' c.project.url = lambda: '/testproject/' app_config = mock.Mock() app_config._id = None app_config.project_id = 'testproject/' app_config.tool_name = 'tool' app_config.options = Object(mount_point = 'foo') c.app = mock.Mock() c.app.config = app_config c.app.config.script_name = lambda:'/testproject/test_application/' c.app.config.url = lambda:'http://testproject/test_application/' c.app.url = c.app.config.url() c.app.__version__ = '0.0'
pkg_resources.require('PasteScript') from paste.deploy import loadapp, appconfig, CONFIG import paste.fixture import paste.script.appinstall from tasktracker.config.routing import * from routes import request_config, url_for from tasktracker.models import * from threading import * from pylons import c from pylons.util import AttribSafeContextObj d = AttribSafeContextObj() c._push_object(d) class TestController(TestCase): def __init__(self, *args): paste.script.appinstall.SetupCommand('setup-app').run(['development.ini#test']) self.conf = appconfig('config:development.ini#test', relative_to=conf_dir) CONFIG.push_process_config({'app_conf': self.conf.local_conf, 'global_conf': self.conf.global_conf}) self.wsgiapp = loadapp('config:development.ini#test', relative_to=conf_dir) # FIXME: Sometimes, for some reason, this attribute isn't set, # which causes url_for to fail request_config().environ = { 'SCRIPT_NAME': '', 'HTTP_HOST': 'localhost', } self.setup_database()