line, book - wf + tests
This commit is contained in:
parent
ba442b726e
commit
654e9d2ee7
25 changed files with 786 additions and 160 deletions
49
tests/test_type.py
Normal file
49
tests/test_type.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
# 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 os, requests
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.exceptions import UserError
|
||||
|
||||
|
||||
class TypeTestCase(ModuleTestCase):
|
||||
'Test cashbook type module'
|
||||
module = 'cashbook'
|
||||
|
||||
@with_transaction()
|
||||
def test_type_read_existing(self):
|
||||
""" read predefined types
|
||||
"""
|
||||
AccType = Pool().get('cashbook.type')
|
||||
|
||||
t_lst = AccType.search([], order=[('name', 'ASC')])
|
||||
self.assertEqual(len(t_lst), 3)
|
||||
self.assertEqual(t_lst[0].rec_name, 'CAS - Cash')
|
||||
self.assertEqual(t_lst[1].rec_name, 'FTD - Fixed-term deposit')
|
||||
self.assertEqual(t_lst[2].rec_name, 'GIR - Giro')
|
||||
|
||||
@with_transaction()
|
||||
def test_type_create(self):
|
||||
""" create account type
|
||||
"""
|
||||
AccType = Pool().get('cashbook.type')
|
||||
|
||||
at, = AccType.create([{
|
||||
'name': 'Test 1',
|
||||
'short': 'T1',
|
||||
}])
|
||||
self.assertEqual(at.name, 'Test 1')
|
||||
self.assertEqual(at.short, 'T1')
|
||||
|
||||
# check unique of short
|
||||
self.assertRaisesRegex(UserError,
|
||||
'The Abbreviation must be unique.',
|
||||
AccType.create,
|
||||
[{
|
||||
'name': 'Test 2',
|
||||
'short': 'T1',
|
||||
}])
|
||||
|
||||
# end TypeTestCase
|
Loading…
Add table
Add a link
Reference in a new issue