[FIX] import openerp.tools instead of tools in YML tests.

bzr revid: vmt@openerp.com-20130209061700-hi720o5wq4hk0cd3
This commit is contained in:
Vo Minh Thu
2013-02-09 07:17:00 +01:00
parent 69fefde965
commit bcefb11482
2 changed files with 9 additions and 9 deletions
+7 -7
View File
@@ -5,7 +5,7 @@
1. Try a few common expressions to verify they work with safe_eval
-
!python {model: ir.model}: |
from tools.safe_eval import safe_eval
from openerp.tools.safe_eval import safe_eval
expected = (1, {"a": 9 * 2}, (True, False, None))
actual = safe_eval('(1, {"a": 9 * 2}, (True, False, None))')
assert actual == expected, "Simple python expressions are not working with safe_eval"
@@ -41,8 +41,8 @@
5. Try forbidden expressions in safe_eval to verify they are not allowed (open)
-
!python {model: ir.model}: |
from tools.safe_eval import safe_eval
from tools.misc import mute_logger
from openerp.tools.safe_eval import safe_eval
from openerp.tools.misc import mute_logger
try:
with mute_logger('openerp.tools.safe_eval'):
safe_eval('open("/etc/passwd","r")')
@@ -146,7 +146,7 @@
"Float precision tests: verify that float rounding methods are working correctly via res.currency"
-
!python {model: res.currency}: |
from tools import float_repr
from openerp.tools import float_repr
from math import log10
currency = self.browse(cr, uid, ref('base.EUR'))
def try_round(amount, expected, self=self, cr=cr, currency=currency, float_repr=float_repr,
@@ -197,7 +197,7 @@
"Float precision tests: verify that float rounding methods are working correctly via tools"
-
!python {model: res.currency}: |
from tools import float_compare, float_is_zero, float_round, float_repr
from openerp.tools import float_compare, float_is_zero, float_round, float_repr
def try_round(amount, expected, precision_digits=3, float_round=float_round, float_repr=float_repr):
result = float_repr(float_round(amount, precision_digits=precision_digits),
precision_digits=precision_digits)
@@ -271,7 +271,7 @@
!python {model: res.currency}: |
currency = self.browse(cr, uid, ref('base.EUR'))
res_currency_rate = self.pool.get('res.currency.rate')
from tools import float_compare, float_is_zero, float_round, float_repr
from openerp.tools import float_compare, float_is_zero, float_round, float_repr
def try_roundtrip(value, expected, self=self, cr=cr, currency=currency,
res_currency_rate=res_currency_rate):
rate_id = res_currency_rate.create(cr, 1, {'name':'2000-01-01',
@@ -289,7 +289,7 @@
"Float precision tests: verify that invalid parameters are forbidden"
-
!python {model: res.currency}: |
from tools import float_compare, float_is_zero, float_round
from openerp.tools import float_compare, float_is_zero, float_round
try:
float_is_zero(0.01, precision_digits=3, precision_rounding=0.01)
except AssertionError:
+2 -2
View File
@@ -12,7 +12,7 @@
I will prepare the context
-
!python {model: res.users }: |
from tools import config
from openerp.tools import config
host = config.get_misc('httpd', 'interface')
port = config.get_misc('httpd', 'port', 8069)
if not host:
@@ -70,4 +70,4 @@
raise AssertionError("User should not be enabled!")
except Fault, e:
if e.faultCode != 'AccessDenied':
raise
raise