2 ##############################################################################
4 # Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
5 # Fabien Pinckaers <fp@tiny.Be>
7 # WARNING: This program as such is intended to be used by professional
8 # programmers who take the whole responsability of assessing all potential
9 # consequences resulting from its eventual inadequacies and bugs
10 # End users who are looking for a ready-to-use solution with commercial
11 # garantees and support are strongly adviced to contract a Free Software
14 # This program is Free Software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 ##############################################################################
31 # This script will automatically test all profiles, localisations and language
32 # packs You must start the Tiny ERP server and not have a test database. You
33 # may also have to change some data in the top of this file.
40 url = 'http://localhost:8069/xmlrpc'
43 'profile_manufacturing',
49 'l10n_chart_uk_minimal'
52 admin_passwd = 'admin'
53 lang = False # List of langs of False for all
55 sock = xmlrpclib.ServerProxy(url+'/object')
56 sock2 = xmlrpclib.ServerProxy(url+'/db')
57 sock3 = xmlrpclib.ServerProxy(url+'/common')
58 sock4 = xmlrpclib.ServerProxy(url+'/wizard')
61 langs = lang or (map(lambda x: x[0], sock2.list_lang()) + ['en_US'])
65 while not progress==1.0:
66 progress,users = sock2.get_progress(admin_passwd, id)
69 def wizard_run(wizname, fieldvalues={}, endstate='end'):
70 wiz_id = sock4.create(dbname, uid, 'admin', wizname)
73 while state!=endstate:
74 res = sock4.execute(dbname, uid, 'admin', wiz_id, datas, state, {})
76 datas['form'].update( res['datas'] )
77 if res['type']=='form':
78 for field in res['fields'].keys():
79 datas['form'][field] = res['fields'][field].get('value', False)
80 state = res['state'][-1][0]
81 datas['form'].update(fieldvalues)
82 elif res['type']=='state':
87 for l10n in l10n_charts:
88 print 'Testing localisation', l10n, '...'
90 print '\tTesting profile', prof, '...'
91 id = sock2.create(admin_passwd, dbname, demo, lang)
93 uid = sock3.login(dbname, 'admin','admin')
95 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)])
97 wizard_run('base_setup.base_setup', {
102 print '\t\tTesting Language', lang, '...'
103 wizard_run('module.lang.install', {'lang': lang})
107 while (not ok) and range:
110 id = sock2.drop(admin_passwd, dbname)