diff options
| author | Vo Minh Thu <vmt@openerp.com> | 2011-09-28 12:30:09 +0200 |
|---|---|---|
| committer | Vo Minh Thu <vmt@openerp.com> | 2011-09-28 12:30:09 +0200 |
| commit | f2c5556b68f6879766dadf6522e35f4afc16696e (patch) | |
| tree | 6cbbcda91d72c4d3998315447075d17abb20e56b /tests/test_ir_sequence.py | |
| parent | 5f4ebc7b1c72fe8eb5dcd947761d8d8f03cd8891 (diff) | |
[FIX] ir_sequence: forgot id argument in _create_sequence().
bzr revid: vmt@openerp.com-20110928103009-17rw1af5ebauu3f5
Diffstat (limited to 'tests/test_ir_sequence.py')
| -rw-r--r-- | tests/test_ir_sequence.py | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_ir_sequence.py b/tests/test_ir_sequence.py new file mode 100644 index 00000000000..ef7e6784daa --- /dev/null +++ b/tests/test_ir_sequence.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +# Run with one of these commands: +# > OPENERP_ADDONS_PATH='../../addons/trunk' OPENERP_PORT=8069 \ +# OPENERP_DATABASE=yy PYTHONPATH=. python tests/test_ir_sequence.py +# > OPENERP_ADDONS_PATH='../../addons/trunk' OPENERP_PORT=8069 \ +# OPENERP_DATABASE=yy nosetests tests/test_ir_sequence.py +# > OPENERP_ADDONS_PATH='../../../addons/trunk' OPENERP_PORT=8069 \ +# OPENERP_DATABASE=yy PYTHONPATH=../:. unit2 test_ir_sequence +import os +import time +import unittest2 +import xmlrpclib + +import openerp +import common + +DB = common.DB +ADMIN_USER_ID = common.ADMIN_USER_ID + +setUpModule = common.setUpModule +tearDownModule = common.tearDownModule + +def registry(model): + return openerp.modules.registry.RegistryManager.get(DB)[model] + +def cursor(): + return openerp.modules.registry.RegistryManager.get(DB).db.cursor() + +class test_ir_sequence(unittest2.TestCase): + + def test_ir_sequence_create(self): + """ Try to create a sequence object. """ + cr = cursor() + try: + d = dict(code='test_sequence_type', name='Test sequence type') + c = registry('ir.sequence.type').create(cr, ADMIN_USER_ID, d, {}) + assert c + d = dict(code='test_sequence_type', name='Test sequence') + c = registry('ir.sequence').create(cr, ADMIN_USER_ID, d, {}) + assert c + cr.commit() + finally: + cr.close() + + def test_ir_sequence_search(self): + """ Try a search. """ + cr = cursor() + try: + ids = registry('ir.sequence').search(cr, ADMIN_USER_ID, [], {}) + assert ids + cr.commit() + finally: + cr.close() + +if __name__ == '__main__': + unittest2.main() + |
