~trobz/web-addons/web-unleashed

« back to all changes in this revision

Viewing changes to web_unleashed/tests/test_js.py

  • Committer: Michel Meyer
  • Date: 2013-11-06 08:39:35 UTC
  • mto: This revision was merged to the branch mainline in revision 10.
  • Revision ID: michel@zazabe.fr-20131106083935-d45hxau78t0hzwol
add web unit tests with travis support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import urlparse
 
2
from openerp import sql_db, tools
 
3
from qunitsuite.suite import QUnitSuite
 
4
 
 
5
class WebSuite(QUnitSuite):
 
6
    
 
7
    def __init__(self):
 
8
        
 
9
        url = urlparse.urlunsplit([
 
10
            'http',
 
11
            'localhost:{port}'.format(port=tools.config['xmlrpc_port']),
 
12
            '/web/tests',
 
13
            'mod=web_unleashed&source={db}&supadmin={supadmin}&password={password}'.format(
 
14
                db=tools.config['db_name'],
 
15
                # al: i dont understand why both are needed, db_password is the
 
16
                # password for postgres and should not appear here of that i'm
 
17
                # sure
 
18
                #
 
19
                # But runbot provides it with this wrong key so i let it here
 
20
                # until it's fixed
 
21
                supadmin=tools.config['db_password'] or 'admin',
 
22
                password=tools.config['admin_passwd'] or 'admin'),
 
23
            ''
 
24
        ])
 
25
        super(WebSuite, self).__init__(url, 50000)
 
26
        
 
27
    def run(self, result):
 
28
        
 
29
        if sql_db._Pool is not None:
 
30
            sql_db._Pool.close_all(sql_db.dsn(tools.config['db_name']))
 
31
        return super(WebSuite, self).run(result)
 
32
 
 
33
def load_tests(loader, standard_tests, _):
 
34
    standard_tests.addTest(WebSuite())
 
35
    return standard_tests