summaryrefslogtreecommitdiff
path: root/addons/web/controllers/testing.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-11-22 12:16:28 +0100
committerXavier Morel <xmo@openerp.com>2012-11-22 12:16:28 +0100
commit3909d1ff0218203755f554eba8ee2a86dbd1405c (patch)
treeaa54252431030ceb1ef5b0a63e85756f21315e06 /addons/web/controllers/testing.py
parent04398646fbdbc5a5616d037dfc739fd666ab1b47 (diff)
[ADD] a bunch of eval domain and context tests
bzr revid: xmo@openerp.com-20121122111628-4khivcp97xoy121i
Diffstat (limited to 'addons/web/controllers/testing.py')
-rw-r--r--addons/web/controllers/testing.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/addons/web/controllers/testing.py b/addons/web/controllers/testing.py
index 3c7c4899b6c..b8e3da8ce24 100644
--- a/addons/web/controllers/testing.py
+++ b/addons/web/controllers/testing.py
@@ -11,7 +11,7 @@ from mako.template import Template
from openerp.modules import module
from .main import module_topological_sort
-from ..http import Controller, httprequest
+from .. import http, nonliterals
NOMODULE_TEMPLATE = Template(u"""<!DOCTYPE html>
<html>
@@ -82,10 +82,22 @@ TESTING = Template(u"""<!DOCTYPE html>
</html>
""")
-class TestRunnerController(Controller):
+nonliteral_test_contexts = [
+ "{'default_opportunity_id': active_id, 'default_duration': 1.0, 'lng': lang}",
+]
+nonliteral_test_domains = [
+ "['|', '&', ('date', '!=', False), ('date', '<=', time.strftime('%Y-%m-%d')), ('is_overdue_quantity', '=', True)]",
+ "[('company_id', '=', context.get('company_id',False))]",
+ "[('year','=',time.strftime('%Y'))]",
+ "[('state','=','draft'),('date_order','<',time.strftime('%Y-%m-%d %H:%M:%S'))]",
+ "[('state','!=','cancel'),('opening_date','>',datetime.date.today().strftime('%Y-%m-%d'))]",
+ "[('type','=','in'),('day','<=', time.strftime('%Y-%m-%d')),('day','>',(datetime.date.today()-datetime.timedelta(days=15)).strftime('%Y-%m-%d'))]",
+]
+
+class TestRunnerController(http.Controller):
_cp_path = '/web/tests'
- @httprequest
+ @http.httprequest
def index(self, req, mod=None, **kwargs):
ms = module.get_modules()
manifests = dict(
@@ -142,6 +154,13 @@ class TestRunnerController(Controller):
if module.get_module_resource(name, 'static')
if manifests[name]['js']]), db_info=json.dumps(db_info))
+ @http.jsonrequest
+ def load_context(self, req, index):
+ return nonliterals.Context(req.session, nonliteral_test_contexts[index])
+ @http.jsonrequest
+ def load_domain(self, req, index):
+ return nonliterals.Domain(req.session, nonliteral_test_domains[index])
+
def load_manifest(self, name):
manifest = module.load_information_from_description_file(name)
if manifest: