[IMP] tests: xml-rpc test drops the created database (which has its own name, not clashing with the main db name).
bzr revid: vmt@openerp.com-20120301105419-8ik3z5eikwjnackk
This commit is contained in:
parent
dac45d4392
commit
d85da03314
|
@ -48,6 +48,8 @@ import openerp.wsgi
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# TODO block until the server is really up, accepting connections
|
||||||
|
# TODO be idemptotent (as long as stop_service was not called).
|
||||||
def start_services():
|
def start_services():
|
||||||
""" Start all services.
|
""" Start all services.
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,13 @@ See the :ref:`test-framework` section in the :ref:`features` list.
|
||||||
|
|
||||||
import test_orm
|
import test_orm
|
||||||
import test_ir_sequence
|
import test_ir_sequence
|
||||||
import test_xmlrpc
|
|
||||||
|
|
||||||
fast_suite = [
|
fast_suite = [
|
||||||
test_xmlrpc, # Creates a database
|
test_ir_sequence,
|
||||||
test_ir_sequence, # Assume an existing database
|
|
||||||
]
|
]
|
||||||
|
|
||||||
checks = [
|
checks = [
|
||||||
test_orm, # Assume an existing database
|
test_orm,
|
||||||
]
|
]
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -74,4 +74,12 @@ class RpcCase(unittest2.TestCase):
|
||||||
self.proxy.db_61 = xmlrpclib.ServerProxy(url_61 + 'db')
|
self.proxy.db_61 = xmlrpclib.ServerProxy(url_61 + 'db')
|
||||||
self.proxy.model_61 = xmlrpclib.ServerProxy(url_61 + 'model/' + DB)
|
self.proxy.model_61 = xmlrpclib.ServerProxy(url_61 + 'model/' + DB)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def generate_database_name(cls):
|
||||||
|
if hasattr(cls, '_database_id'):
|
||||||
|
cls._database_id += 1
|
||||||
|
else:
|
||||||
|
cls._database_id = 0
|
||||||
|
return '_fresh_name_' + str(cls._database_id) + '_'
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -13,12 +13,15 @@ import xmlrpclib
|
||||||
import openerp
|
import openerp
|
||||||
import common
|
import common
|
||||||
|
|
||||||
DB = common.DB
|
DB = None
|
||||||
ADMIN_USER = common.ADMIN_USER
|
ADMIN_USER = common.ADMIN_USER
|
||||||
ADMIN_USER_ID = common.ADMIN_USER_ID
|
ADMIN_USER_ID = common.ADMIN_USER_ID
|
||||||
ADMIN_PASSWORD = common.ADMIN_PASSWORD
|
ADMIN_PASSWORD = common.ADMIN_PASSWORD
|
||||||
|
|
||||||
setUpModule = common.start_openerp
|
def setUpModule():
|
||||||
|
common.start_openerp()
|
||||||
|
global DB
|
||||||
|
DB = common.RpcCase.generate_database_name()
|
||||||
|
|
||||||
tearDownModule = common.stop_openerp
|
tearDownModule = common.stop_openerp
|
||||||
|
|
||||||
|
@ -29,8 +32,8 @@ class test_xmlrpc(common.RpcCase):
|
||||||
Simulate a OpenERP client requesting the creation of a database and
|
Simulate a OpenERP client requesting the creation of a database and
|
||||||
polling the server until the creation is complete.
|
polling the server until the creation is complete.
|
||||||
"""
|
"""
|
||||||
progress_id = self.proxy.db_60.create(ADMIN_PASSWORD, DB, True,
|
progress_id = self.proxy.db_60.create(ADMIN_PASSWORD,DB, True, False,
|
||||||
False, ADMIN_PASSWORD)
|
ADMIN_PASSWORD)
|
||||||
while True:
|
while True:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
progress, users = self.proxy.db_60.get_progress(ADMIN_PASSWORD,
|
progress, users = self.proxy.db_60.get_progress(ADMIN_PASSWORD,
|
||||||
|
@ -55,12 +58,19 @@ class test_xmlrpc(common.RpcCase):
|
||||||
def test_xmlrpc_61_ir_model_search(self):
|
def test_xmlrpc_61_ir_model_search(self):
|
||||||
""" Try a search on the object service. """
|
""" Try a search on the object service. """
|
||||||
|
|
||||||
proxy = xmlrpclib.ServerProxy(self.proxy.url_61 + 'model/' + DB + '/ir.model')
|
proxy = xmlrpclib.ServerProxy(self.proxy.url_61 + 'model/' + DB +
|
||||||
|
'/ir.model')
|
||||||
ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [])
|
ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [])
|
||||||
assert ids
|
assert ids
|
||||||
ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [], {})
|
ids = proxy.execute(ADMIN_USER_ID, ADMIN_PASSWORD, 'search', [], {})
|
||||||
assert ids
|
assert ids
|
||||||
|
|
||||||
|
def test_zz_xmlrpc_drop_database(self):
|
||||||
|
"""
|
||||||
|
Simulate a OpenERP client requesting the deletion of a database.
|
||||||
|
"""
|
||||||
|
assert self.proxy.db_60.drop(ADMIN_PASSWORD, DB) is True
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest2.main()
|
unittest2.main()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue