[IMP] cleanups, move tests, remove deprecated model instantiation
bzr revid: al@openerp.com-20140501184217-pgi1gzbdpysdybog
This commit is contained in:
parent
5e21a4235d
commit
8d04c66dc3
|
@ -93,9 +93,9 @@ The kernel of OpenERP, needed for all installation.
|
|||
'res/res_partner_image_demo.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/base_test.yml',
|
||||
'test/test_osv_expression.yml',
|
||||
'test/test_ir_rule.yml', # <-- These tests modify/add/delete ir_rules.
|
||||
'tests/base_test.yml',
|
||||
'tests/test_osv_expression.yml',
|
||||
'tests/test_ir_rule.yml', # <-- These tests modify/add/delete ir_rules.
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
|
|
|
@ -43,7 +43,5 @@ class ir_default(osv.osv):
|
|||
_defaults = {
|
||||
'company_id': _get_company_id,
|
||||
}
|
||||
ir_default()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -31,7 +31,6 @@ class ir_exports(osv.osv):
|
|||
'export_fields': fields.one2many('ir.exports.line', 'export_id',
|
||||
'Export ID'),
|
||||
}
|
||||
ir_exports()
|
||||
|
||||
|
||||
class ir_exports_line(osv.osv):
|
||||
|
@ -41,7 +40,6 @@ class ir_exports_line(osv.osv):
|
|||
'name': fields.char('Field Name', size=64),
|
||||
'export_id': fields.many2one('ir.exports', 'Export', select=True, ondelete='cascade'),
|
||||
}
|
||||
ir_exports_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -142,6 +142,4 @@ class ir_filters(osv.osv):
|
|||
'is_default': False
|
||||
}
|
||||
|
||||
ir_filters()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -172,7 +172,4 @@ class ir_rule(osv.osv):
|
|||
self.clear_cache(cr,uid)
|
||||
return res
|
||||
|
||||
ir_rule()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -177,9 +177,4 @@ class ir_property(osv.osv):
|
|||
'|', ('company_id', '=', cid), ('company_id', '=', False)]
|
||||
return domain
|
||||
|
||||
ir_property()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -51,9 +51,6 @@ class Bank(osv.osv):
|
|||
result.append((bank.id, (bank.bic and (bank.bic + ' - ') or '') + bank.name))
|
||||
return result
|
||||
|
||||
Bank()
|
||||
|
||||
|
||||
class res_partner_bank_type(osv.osv):
|
||||
_description='Bank Account Type'
|
||||
_name = 'res.partner.bank.type'
|
||||
|
@ -67,7 +64,6 @@ class res_partner_bank_type(osv.osv):
|
|||
_defaults = {
|
||||
'format_layout': lambda *args: "%(bank_name)s: %(acc_number)s"
|
||||
}
|
||||
res_partner_bank_type()
|
||||
|
||||
class res_partner_bank_type_fields(osv.osv):
|
||||
_description='Bank type fields'
|
||||
|
@ -80,8 +76,6 @@ class res_partner_bank_type_fields(osv.osv):
|
|||
'readonly': fields.boolean('Readonly'),
|
||||
'size': fields.integer('Max. Size'),
|
||||
}
|
||||
res_partner_bank_type_fields()
|
||||
|
||||
|
||||
class res_partner_bank(osv.osv):
|
||||
'''Bank Accounts'''
|
||||
|
@ -234,6 +228,4 @@ class res_partner_bank(osv.osv):
|
|||
result['state_id'] = part.state_id.id
|
||||
return {'value': result}
|
||||
|
||||
res_partner_bank()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -235,8 +235,6 @@ class res_currency(osv.osv):
|
|||
else:
|
||||
return from_amount * rate
|
||||
|
||||
res_currency()
|
||||
|
||||
class res_currency_rate_type(osv.osv):
|
||||
_name = "res.currency.rate.type"
|
||||
_description = "Currency Rate Type"
|
||||
|
@ -244,8 +242,6 @@ class res_currency_rate_type(osv.osv):
|
|||
'name': fields.char('Name', size=64, required=True, translate=True),
|
||||
}
|
||||
|
||||
res_currency_rate_type()
|
||||
|
||||
class res_currency_rate(osv.osv):
|
||||
_name = "res.currency.rate"
|
||||
_description = "Currency Rate"
|
||||
|
@ -261,7 +257,5 @@ class res_currency_rate(osv.osv):
|
|||
}
|
||||
_order = "name desc"
|
||||
|
||||
res_currency_rate()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
-
|
||||
I will now stress the authentication layer of the ORM
|
||||
-
|
||||
I create a test user.
|
||||
-
|
||||
!record {model: res.users, id: res_user_test_a1}:
|
||||
name: Test Auth User 1
|
||||
login: test_base_a1
|
||||
password: 'base-test-passwd'
|
||||
active: True
|
||||
-
|
||||
I will prepare the context
|
||||
-
|
||||
!python {model: res.users }: |
|
||||
from openerp.tools import config
|
||||
host = config.get_misc('httpd', 'interface')
|
||||
port = config.get_misc('httpd', 'port', 8069)
|
||||
if not host:
|
||||
host = config.get('xmlrpc_interface')
|
||||
port = config.get('xmlrpc_port') or self.port
|
||||
if host == '0.0.0.0' or not host:
|
||||
host = '127.0.0.1'
|
||||
port = int(port)
|
||||
context['test_xmlrpc_url'] = 'http://%s:%d/xmlrpc/' % (host, port)
|
||||
-
|
||||
I will commit the cursor and try to login.
|
||||
-
|
||||
!python {model: res.users }: |
|
||||
from xmlrpclib import ServerProxy
|
||||
cr.commit()
|
||||
try:
|
||||
logsock = ServerProxy(context['test_xmlrpc_url']+'common')
|
||||
luid = logsock.login(cr.dbname, 'test_base_a1', 'base-test-passwd')
|
||||
assert luid, "User is not activated after res.users commit!"
|
||||
except Exception:
|
||||
raise
|
||||
-
|
||||
I will just try to read something as that user
|
||||
-
|
||||
!python {model: res.users }: |
|
||||
from xmlrpclib import ServerProxy
|
||||
cr.commit()
|
||||
try:
|
||||
logsock = ServerProxy(context['test_xmlrpc_url']+'object')
|
||||
luid = ref('res_user_test_a1')
|
||||
res = logsock.execute(cr.dbname, luid, 'base-test-passwd', 'res.users', 'read', luid, ['name',])
|
||||
assert res and res['name'], "User cannot read its name!"
|
||||
except Exception:
|
||||
raise
|
||||
-
|
||||
I will now disable the user.
|
||||
-
|
||||
!record {model: res.users, id: res_user_test_a1}:
|
||||
active: False
|
||||
-
|
||||
I will commit the cursor.
|
||||
-
|
||||
!python {model: res.users }: |
|
||||
cr.commit()
|
||||
-
|
||||
I will try to read again, connecting as the disabled user.
|
||||
-
|
||||
!python {model: res.users }: |
|
||||
from xmlrpclib import ServerProxy
|
||||
cr.commit()
|
||||
try:
|
||||
logsock = ServerProxy(context['test_xmlrpc_url']+'object')
|
||||
luid = ref('res_user_test_a1')
|
||||
res = logsock.execute(cr.dbname, luid, 'base-test-passwd', 'res.users', 'read', luid, ['name',])
|
||||
raise AssertionError("User should not be enabled!")
|
||||
except Fault, e:
|
||||
if e.faultCode != 'AccessDenied':
|
||||
raise
|
Loading…
Reference in New Issue