~openerp-dev/openobject-server/trunk-gunicorn-signaling-vmt

« back to all changes in this revision

Viewing changes to openerp/tests/test_xmlrpc.py

  • Committer: Vo Minh Thu
  • Date: 2012-03-07 11:10:30 UTC
  • mfrom: (4001.1.83 server)
  • Revision ID: vmt@openerp.com-20120307111030-8hzhzm0zoo34nuj7
[MERGE] merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
import openerp
14
14
import common
15
15
 
16
 
DB = common.DB
 
16
DB = None
17
17
ADMIN_USER = common.ADMIN_USER
18
18
ADMIN_USER_ID = common.ADMIN_USER_ID
19
19
ADMIN_PASSWORD = common.ADMIN_PASSWORD
20
20
 
21
21
def setUpModule():
22
 
  common.start_openerp()
23
 
  common.create_xmlrpc_proxies()
24
 
 
25
 
tearDownModule = common.tearDownModule
26
 
 
27
 
class test_xmlrpc(unittest2.TestCase):
 
22
    common.start_openerp()
 
23
    global DB
 
24
    DB = common.RpcCase.generate_database_name()
 
25
 
 
26
tearDownModule = common.stop_openerp
 
27
 
 
28
class test_xmlrpc(common.RpcCase):
28
29
 
29
30
    def test_00_xmlrpc_create_database_polling(self):
30
31
        """
31
32
        Simulate a OpenERP client requesting the creation of a database and
32
33
        polling the server until the creation is complete.
33
34
        """
34
 
        progress_id = common.db_proxy_60.create(ADMIN_PASSWORD, DB, True,
35
 
            False, ADMIN_PASSWORD)
 
35
        progress_id = self.proxy.db_60.create(ADMIN_PASSWORD,DB, True, False,
 
36
            ADMIN_PASSWORD)
36
37
        while True:
37
38
            time.sleep(1)
38
 
            progress, users = common.db_proxy_60.get_progress(ADMIN_PASSWORD,
 
39
            progress, users = self.proxy.db_60.get_progress(ADMIN_PASSWORD,
39
40
                progress_id)
40
41
            if progress == 1.0:
41
42
                break
42
43
 
43
44
    def test_xmlrpc_login(self):
44
45
        """ Try to login on the common service. """
45
 
        uid = common.common_proxy_60.login(DB, ADMIN_USER, ADMIN_PASSWORD)
 
46
        uid = self.proxy.common_60.login(DB, ADMIN_USER, ADMIN_PASSWORD)
46
47
        assert uid == ADMIN_USER_ID
47
48
 
48
49
    def test_xmlrpc_ir_model_search(self):
49
50
        """ Try a search on the object service. """
50
 
        ids = common.object_proxy_60.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD,
 
51
        ids = self.proxy.object_60.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD,
51
52
            'ir.model', 'search', [])
52
53
        assert ids
53
 
        ids = common.object_proxy_60.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD,
 
54
        ids = self.proxy.object_60.execute(DB, ADMIN_USER_ID, ADMIN_PASSWORD,
54
55
            'ir.model', 'search', [], {})
55
56
        assert ids
56
57
 
57
58
    def test_xmlrpc_61_ir_model_search(self):
58
59
        """ Try a search on the object service. """
59
60
 
60
 
        proxy = xmlrpclib.ServerProxy(common.model_uri_61 + 'model/' + DB + '/ir.model')
 
61
        proxy = xmlrpclib.ServerProxy(self.proxy.url_61 + 'model/' + DB +
 
62
            '/ir.model')
61
63
        ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [])
62
64
        assert ids
63
65
        ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [], {})
64
66
        assert ids
65
67
 
 
68
    def test_zz_xmlrpc_drop_database(self):
 
69
        """
 
70
        Simulate a OpenERP client requesting the deletion of a database.
 
71
        """
 
72
        assert self.proxy.db_60.drop(ADMIN_PASSWORD, DB) is True
 
73
 
66
74
if __name__ == '__main__':
67
75
    unittest2.main()
68
76