[IMP] allow providing db-cloning info directly in URL for test runner

bzr revid: xmo@openerp.com-20121030074615-lt517w5t9fd9ppvh
This commit is contained in:
Xavier Morel 2012-10-30 08:46:15 +01:00
parent 523f4a6e03
commit d2cf844e7b
2 changed files with 9 additions and 2 deletions

View File

@ -51,6 +51,7 @@ TESTING = Template(u"""<!DOCTYPE html>
<script src="/web/static/lib/qunit/qunit.js"></script>
<script type="text/javascript">
var oe_db_info = ${db_info};
// List of modules, each module is preceded by its dependencies
var oe_all_dependencies = ${dependencies};
QUnit.config.testTimeout = 10000;
@ -130,10 +131,16 @@ class TestRunnerController(Controller):
for mod, tests in itertools.izip(sorted_mods, tests)
]
# if all three db_info parameters are present, send them to the page
db_info = dict((k, v) for k, v in kwargs.iteritems()
if k in ['source', 'supadmin', 'password'])
if len(db_info) != 3:
db_info = None
return TESTING.render(files=files, dependencies=json.dumps(
[name for name in sorted_mods
if module.get_module_resource(name, 'static')
if manifests[name]['js']]))
if manifests[name]['js']]), db_info=json.dumps(db_info))
def load_manifest(self, name):
manifest = module.load_information_from_description_file(name)

View File

@ -85,7 +85,7 @@ openerp.testing = {};
};
};
var db = window['oe_db_info'] || undefined;
var db = window['oe_db_info'];
testing.section = function (name, options, body) {
if (_.isFunction(options)) {
body = options;