def load_melange(): """Prepare Melange for usage. Registers a core, the GSoC and GCI modules, and calls the sitemap, sidebar and rights services. """ from soc.modules import callback from soc.modules.core import Core # Register a core for the test modules to use callback.registerCore(Core()) current_core = callback.getCore() callback_module_names = [ 'codein.callback', 'melange.callback', 'soc.modules.soc_core.callback', 'soc.modules.gsoc.callback', 'soc.modules.gci.callback', 'summerofcode.callback' ] current_core.registerModuleCallbacks(callback_module_names) # Make sure all services are called current_core.callService('registerViews', True) current_core.callService('registerWithSitemap', True) current_core.callService('registerWithSidebar', True) current_core.callService('registerRights', True)
def main(): sys.path = extra_paths + sys.path os.environ['SERVER_SOFTWARE'] = 'Development via nose' os.environ['SERVER_NAME'] = 'Foo' os.environ['SERVER_PORT'] = '8080' os.environ['APPLICATION_ID'] = 'test-app-run' os.environ['USER_EMAIL'] = '*****@*****.**' os.environ['CURRENT_VERSION_ID'] = 'testing-version' os.environ['HTTP_HOST'] = 'some.testing.host.tld' import main as app_main from google.appengine.api import apiproxy_stub_map from google.appengine.api import datastore_file_stub from google.appengine.api import mail_stub from google.appengine.api import user_service_stub from google.appengine.api import urlfetch_stub from google.appengine.api.memcache import memcache_stub apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap() apiproxy_stub_map.apiproxy.RegisterStub( 'urlfetch', urlfetch_stub.URLFetchServiceStub()) apiproxy_stub_map.apiproxy.RegisterStub( 'user', user_service_stub.UserServiceStub()) apiproxy_stub_map.apiproxy.RegisterStub( 'datastore', datastore_file_stub.DatastoreFileStub('test-app-run', None, None)) apiproxy_stub_map.apiproxy.RegisterStub( 'memcache', memcache_stub.MemcacheServiceStub()) apiproxy_stub_map.apiproxy.RegisterStub('mail', mail_stub.MailServiceStub()) import django.test.utils django.test.utils.setup_test_environment() # register a core for the test modules to use from soc.modules import callback from soc.modules import core callback.registerCore(core.Core()) callback.getCore().registerModuleCallbacks() plugins = [AppEngineDatastoreClearPlugin()] if '--coverage' in sys.argv: from nose.plugins import cover plugin = cover.Coverage() plugins.append(plugin) args = [ '--with-coverage', '--cover-package=soc', '--cover-erase', '--cover-html', '--cover-html-dir=coverageResults' ] sys.argv.remove('--coverage') sys.argv += args nose.main(plugins=plugins)
def real_main(): """Main program without profiling. """ import django.core.handlers.wsgi # Create a Django application for WSGI. application = django.core.handlers.wsgi.WSGIHandler() from soc.modules import callback from soc.modules import core callback.registerCore(core.Core()) callback.getCore().registerModuleCallbacks() # Run the WSGI CGI handler with that application. util.run_wsgi_app(application)
def load_melange(): """Prepare Melange for usage. Registers a core, the GSoC and GCI modules, and calls the sitemap, sidebar and rights services. """ from soc.modules import callback from soc.modules.core import Core # Register a core for the test modules to use callback.registerCore(Core()) current_core = callback.getCore() modules = ['gsoc', 'gci', 'seeder', 'statistic'] fmt = 'soc.modules.%s.callback' current_core.registerModuleCallbacks(modules, fmt) # Make sure all services are called current_core.callService('registerViews', True) current_core.callService('registerWithSitemap', True) current_core.callService('registerWithSidebar', True) current_core.callService('registerRights', True)