Add test for RPC to compute method

issue7228
review45271002
This commit is contained in:
Cédric Krier
2018-04-05 19:28:36 +02:00
parent 67f3a12325
commit e8c491a764
3 changed files with 35 additions and 0 deletions
+5
View File
@@ -53,6 +53,7 @@ for dep in info.get('depends', []):
requires.append(get_require_version('trytond_%s' % dep))
requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')]
dependency_links = []
if minor_version % 2:
dependency_links.append('https://trydevpi.tryton.org/')
@@ -119,5 +120,9 @@ setup(name=name,
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
use_2to3=True,
convert_2to3_doctests=[
'tests/scenario_currency_compute.rst',
],
)
+22
View File
@@ -0,0 +1,22 @@
=========================
Currency Compute Scenario
=========================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.currency.tests.tools import get_currency
Install currency::
>>> config = activate_modules('currency')
Call compute::
>>> Currency = Model.get('currency.currency')
>>> usd = get_currency(code='USD')
>>> eur = get_currency(code='EUR')
>>> Currency.compute(usd.id, Decimal('10.00'), eur.id, {})
Decimal('20.00')
+8
View File
@@ -1,11 +1,14 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
import doctest
import unittest
from decimal import Decimal
import trytond.tests.test_tryton
from trytond.transaction import Transaction
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.tests.test_tryton import doctest_teardown
from trytond.tests.test_tryton import doctest_checker
from trytond.pool import Pool
@@ -257,4 +260,9 @@ def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CurrencyTestCase))
suite.addTests(doctest.DocFileSuite(
'scenario_currency_compute.rst',
tearDown=doctest_teardown, encoding='utf-8',
checker=doctest_checker,
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite