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