[MERGE] bounce effects, minor fixes in saas
[odoo/odoo.git] / addons / web / test_support / __init__.py
1 # -*- coding: utf-8 -*-
2 import xmlrpclib
3 from ..common.openerplib.main import Connector
4
5 execute_map = {}
6
7 class TestConnector(Connector):
8     def db_list_lang(self):
9         return [('en_US', u'Test Language')]
10
11     def common_authenticate(self, db, login, password, environment):
12         return 87539319
13
14     def common_login(self, db, login, password):
15         return self.common_authenticate(db, login, password, {})
16
17     def object_execute_kw(self, db, uid, password, model, method, args, kwargs):
18         if model in execute_map and hasattr(execute_map[model], method):
19             return getattr(execute_map[model], method)(*args, **kwargs)
20
21         raise xmlrpclib.Fault({
22             'model': model,
23             'method': method,
24             'args': args,
25             'kwargs': kwargs
26         }, '')
27
28     def send(self, service_name, method, *args):
29         method_name = '%s_%s' % (service_name, method)
30         if hasattr(self, method_name):
31             return getattr(self, method_name)(*args)
32
33         raise xmlrpclib.Fault({
34             'service': service_name,
35             'method': method,
36             'args': args
37         }, '')