Updated script
authorFabien Pinckaers <fp@tinyerp.com>
Tue, 14 Aug 2007 07:44:48 +0000 (07:44 +0000)
committerFabien Pinckaers <fp@tinyerp.com>
Tue, 14 Aug 2007 07:44:48 +0000 (07:44 +0000)
bzr revid: fp@tinyerp.com-b1c176752968c00ebf6b1d21029ecb132e401810

doc/tests/check_profile_l10n_all.py

index 2bc1684..4ff277e 100755 (executable)
@@ -1,3 +1,4 @@
+#!/usr/bin/python
 ##############################################################################
 #
 # Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
@@ -65,38 +66,42 @@ def wait(id):
                progress,users = sock2.get_progress(admin_passwd, id)
        return True
 
+def wizard_run(wizname, fieldvalues={}, endstate='end'):
+       wiz_id = sock4.create(dbname, uid, 'admin', wizname)
+       state = 'init'
+       datas = {'form':{}}
+       while state!=endstate:
+               res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {})
+               if 'datas' in res:
+                       datas['form'].update( res['datas'] )
+               if res['type']=='form':
+                       for field in res['fields'].keys():
+                               datas['form'][field] = res['fields'][field].get('value', False)
+                       state = res['state'][-1][0]
+                       datas['form'].update(fieldvalues)
+               elif res['type']=='state':
+                       state = res['state']
+       return True
+
 for demo in demos:
-       for lang in langs:
-               print 'Testing Language', lang, 'with demo', demo, '...'
                for l10n in l10n_charts:
-                       print '\tTesting localisation', l10n, '...'
+                       print 'Testing localisation', l10n, '...'
                        for prof in profiles:
-                               print '\t\tTesting profile', prof, '...'
+                               print '\tTesting profile', prof, '...'
                                id = sock2.create(admin_passwd, dbname, demo, lang)
-                               print 'Creating DB', id
                                wait(id)
                                uid = sock3.login(dbname, 'admin','admin')
 
                                idprof = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',prof)])
                                idl10n = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',l10n)])
-                               wiz_id = sock4.create(dbname, uid, 'admin', 'base_setup.base_setup')
-                               state = 'init'
-                               datas = {'form':{}}
-                               while state!='menu':
-                                       res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {})
-                                       if 'datas' in res:
-                                               datas['form'].update( res['datas'] )
-                                       if res['type']=='form':
-                                               for field in res['fields'].keys():
-                                                       datas['form'][field] = res['fields'][field].get('value', False)
-                                               state = res['state'][-1][0]
-                                               datas['form'].update({
-                                                       'profile': idprof[0],
-                                                       'charts': idl10n[0],
-                                               })
-                                       elif res['type']=='state':
-                                               state = res['state']
-                               sock.execute(dbname, uid, 'admin', 'res.partner', 'search', [])
+                               wizard_run('base_setup.base_setup', {
+                                       'profile': idprof[0],
+                                       'charts': idl10n[0],
+                               }, 'menu')
+                               for lang in langs:
+                                       print '\t\tTesting Language', lang, '...'
+                                       wizard_run('module.lang.install', {'lang': lang})
+
                                ok = False
                                range = 4
                                while (not ok) and range: