2 # -*- coding: utf-8 -*-
3 ##############################################################################
5 # OpenERP, Open Source Management Solution
6 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
24 # This script will automatically test all profiles, localisations and language
25 # packs You must start the OpenERP server and not have a test database. You
26 # may also have to change some data in the top of this file.
33 url = 'http://localhost:8069/xmlrpc'
37 'profile_manufacturing'
46 admin_passwd = 'admin'
47 lang = False # List of langs of False for all
50 sock = xmlrpclib.ServerProxy(url+'/object')
51 sock2 = xmlrpclib.ServerProxy(url+'/db')
52 sock3 = xmlrpclib.ServerProxy(url+'/common')
53 sock4 = xmlrpclib.ServerProxy(url+'/wizard')
56 langs = lang or (map(lambda x: x[0], sock2.list_lang()) + ['en_US'])
60 while not progress==1.0:
62 progress,users = sock2.get_progress(admin_passwd, id)
66 def wizard_run(wizname, fieldvalues=None, endstate='end'):
67 if fieldvalues is None:
69 wiz_id = sock4.create(dbname, uid, 'admin', wizname)
72 while state!=endstate:
73 res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {})
75 datas['form'].update( res['datas'] )
76 if res['type']=='form':
77 for field in res['fields'].keys():
78 datas['form'][field] = res['fields'][field].get('value', False)
79 state = res['state'][-1][0]
80 datas['form'].update(fieldvalues)
81 elif res['type']=='state':
86 for l10n in l10n_charts:
87 print 'Testing localisation', l10n, '...'
89 print '\tTesting profile', prof, '...'
90 id = sock2.create(admin_passwd, dbname, demo, lang)
92 uid = sock3.login(dbname, 'admin','admin')
94 idprof = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',prof)])
96 idl10n = sock.execute(dbname, uid, 'admin', 'ir.module.module', 'search', [('name','=',l10n)])
99 wizard_run('base_setup.base_setup', {
100 'profile': idprof[0],
104 print '\t\tTesting Language', lang, '...'
105 wizard_run('module.lang.install', {'lang': lang})
109 while (not ok) and range:
112 id = sock2.drop(admin_passwd, dbname)
121 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: