1 # -*- coding: utf-8 -*-
2 # Run with one of these commands:
3 # > OPENERP_ADDONS_PATH='../../addons/trunk' OPENERP_PORT=8069 \
4 # OPENERP_DATABASE=yy PYTHONPATH=. python tests/test_xmlrpc.py
5 # > OPENERP_ADDONS_PATH='../../addons/trunk' OPENERP_PORT=8069 \
6 # OPENERP_DATABASE=yy nosetests tests/test_xmlrpc.py
7 # > OPENERP_ADDONS_PATH='../../../addons/trunk' OPENERP_PORT=8069 \
8 # OPENERP_DATABASE=yy PYTHONPATH=../:. unit2 test_xmlrpc
16 ADMIN_USER = common.ADMIN_USER
17 ADMIN_USER_ID = common.ADMIN_USER_ID
18 ADMIN_PASSWORD = common.ADMIN_PASSWORD
21 common.start_openerp()
23 DB = common.RpcCase.generate_database_name()
25 tearDownModule = common.stop_openerp
27 class test_xmlrpc(common.RpcCase):
29 def test_00_xmlrpc_create_database_polling(self):
31 Simulate a OpenERP client requesting the creation of a database and
32 polling the server until the creation is complete.
34 progress_id = self.proxy.db_60.create(ADMIN_PASSWORD,DB, True, False,
38 progress, users = self.proxy.db_60.get_progress(ADMIN_PASSWORD,
43 def test_xmlrpc_login(self):
44 """ Try to login on the common service. """
45 uid = self.proxy.common_60.login(DB, ADMIN_USER, ADMIN_PASSWORD)
46 assert uid == ADMIN_USER_ID
48 def test_xmlrpc_ir_model_search(self):
49 """ Try a search on the object service. """
50 o = self.proxy.object_60
51 ids = o.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD, 'ir.model', 'search', [])
53 ids = o.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD, 'ir.model', 'search', [], {})
56 def test_xmlrpc_8_ir_model_search(self):
57 """ Try a search on the object service. """
58 o = self.proxy.object_8
59 ids = o.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD, 'ir.model', 'search', [])
61 ids = o.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD, 'ir.model', 'search', [], {})
64 # This test was written to test the creation of a new RPC endpoint, not
65 # really for the EDI itself.
66 #def test_xmlrpc_import_edi_document(self):
67 # """ Try to call an EDI method. """
68 # msg_re = 'EDI Document is empty!'
69 # with self.assertRaisesRegexp(Exception, msg_re):
70 # self.proxy.edi_60.import_edi_document(DB, ADMIN_USER_ID, ADMIN_PASSWORD, {})
72 def test_zz_xmlrpc_drop_database(self):
74 Simulate a OpenERP client requesting the deletion of a database.
76 assert self.proxy.db_60.drop(ADMIN_PASSWORD, DB) is True
78 if __name__ == '__main__':
82 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: