cashbook/tests/test_accounttype.py
2022-08-05 16:47:43 +02:00

37 lines
1 KiB
Python

# 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 AccounttypeTestCase(ModuleTestCase):
'Test account type module'
module = 'cashbook'
@with_transaction()
def test_accounttype_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 AccounttypeTestCase