X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=openerp-web;h=3340b95646e69d9abb2078b4e264a272ecd5de34;hb=397c67348e6672e81a28021caa6e97162da2ca51;hp=a3b3d2fa1d53e5180fe1f920988d8e47bd40335a;hpb=0d7b80ac44867a5b9fbc5a8ec449976989ab21fd;p=odoo%2Fodoo.git diff --git a/openerp-web b/openerp-web index a3b3d2f..3340b95 100755 --- a/openerp-web +++ b/openerp-web @@ -50,6 +50,19 @@ logging_opts.add_option("--log-config", dest="log_config", default=os.path.join( help="Logging configuration file", metavar="FILE") optparser.add_option_group(logging_opts) +testing_opts = optparse.OptionGroup(optparser, "Testing") +testing_opts.add_option('--test-mode', dest='test_mode', + action='store_true', default=False, + help="Starts test mode, which provides a few" + " (utterly unsafe) APIs for testing purposes and" + " sets up a special connector which always raises" + " errors on tentative server access. These errors" + " serialize RPC query information (service," + " method, arguments list) in the fault_code" + " attribute of the error object returned to the" + " client. This lets javascript code assert the" \ + " XMLRPC consequences of its queries.") +optparser.add_option_group(testing_opts) if __name__ == "__main__": (options, args) = optparser.parse_args(sys.argv[1:]) @@ -78,6 +91,12 @@ if __name__ == "__main__": options.backend = 'xmlrpc' os.environ["TZ"] = "UTC" + if options.test_mode: + import web.test_support + import web.test_support.controllers + options.connector = web.test_support.TestConnector() + logging.getLogger('werkzeug').setLevel(logging.WARNING) + if sys.version_info >= (2, 7) and os.path.exists(options.log_config): with open(options.log_config) as file: dct = json.load(file) @@ -86,7 +105,7 @@ if __name__ == "__main__": else: logging.basicConfig(level=getattr(logging, options.log_level.upper())) - app = web.common.http.Root(options) + app = web.common.http.Root(options, openerp_addons_namespace=False) if options.proxy_mode: app = werkzeug.contrib.fixers.ProxyFix(app)