rates: speichert kurse
This commit is contained in:
parent
353df93a9e
commit
42ede3decb
15 changed files with 335 additions and 12 deletions
|
@ -5,12 +5,14 @@ import trytond.tests.test_tryton
|
|||
import unittest
|
||||
|
||||
from trytond.modules.investment.tests.test_asset import AssetTestCase
|
||||
from trytond.modules.investment.tests.test_rate import RateTestCase
|
||||
|
||||
|
||||
__all__ = ['suite']
|
||||
|
||||
|
||||
class InvestmentTestCase(\
|
||||
RateTestCase,\
|
||||
AssetTestCase,\
|
||||
):
|
||||
'Test investment module'
|
||||
|
|
|
@ -5,9 +5,7 @@
|
|||
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.modules.company.tests import create_company
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
|
|
50
tests/test_rate.py
Normal file
50
tests/test_rate.py
Normal file
|
@ -0,0 +1,50 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||
# The COPYRIGHT file at the top level of this repository contains the
|
||||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.modules.company.tests import create_company
|
||||
from decimal import Decimal
|
||||
from datetime import date
|
||||
|
||||
|
||||
class RateTestCase(ModuleTestCase):
|
||||
'Test rate module'
|
||||
module = 'investment'
|
||||
|
||||
@with_transaction()
|
||||
def test_rate_create(self):
|
||||
""" create rate
|
||||
"""
|
||||
Asset = Pool().get('investment.asset')
|
||||
|
||||
company = self.prep_asset_company()
|
||||
product = self.prep_asset_product(
|
||||
name='Product 1',
|
||||
description='some asset')
|
||||
|
||||
asset = self.prep_asset_item(
|
||||
company=company,
|
||||
product = product)
|
||||
|
||||
Asset.write(*[
|
||||
[asset],
|
||||
{
|
||||
'rates': [('create', [{
|
||||
'date': date(2022, 5, 1),
|
||||
'rate': Decimal('2.5'),
|
||||
}, {
|
||||
'date': date(2022, 5, 2),
|
||||
'rate': Decimal('2.8'),
|
||||
}])],
|
||||
}])
|
||||
self.assertEqual(len(asset.rates), 2)
|
||||
self.assertEqual(asset.rates[0].date, date(2022, 5, 2))
|
||||
self.assertEqual(asset.rates[0].rate, Decimal('2.8'))
|
||||
self.assertEqual(asset.rates[0].uom.rec_name, 'Unit')
|
||||
self.assertEqual(asset.rates[0].asset_digits, 4)
|
||||
self.assertEqual(asset.rates[0].currency.rec_name, 'usd')
|
||||
|
||||
# end RateTestCase
|
Loading…
Add table
Add a link
Reference in a new issue