mirror of
https://github.com/NaN-tic/trytond-party_company.git
synced 2023-12-14 03:32:57 +01:00
Add test
This commit is contained in:
parent
58c023e6a3
commit
edbd0e8635
|
@ -5,12 +5,40 @@ import unittest
|
||||||
import trytond.tests.test_tryton
|
import trytond.tests.test_tryton
|
||||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
from trytond.modules.company.tests import create_company, set_company
|
||||||
|
|
||||||
|
|
||||||
class PartyCompanyTestCase(ModuleTestCase):
|
class PartyCompanyTestCase(ModuleTestCase):
|
||||||
'Test Party Company module'
|
'Test Party Company module'
|
||||||
module = 'party_company'
|
module = 'party_company'
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_party(self):
|
||||||
|
'Create party'
|
||||||
|
pool = Pool()
|
||||||
|
Party = pool.get('party.party')
|
||||||
|
|
||||||
|
party1, = Party.create([{
|
||||||
|
'name': 'Party 1',
|
||||||
|
}])
|
||||||
|
self.assert_(party1.id)
|
||||||
|
self.assertEqual(party1.company, None)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_party_company(self):
|
||||||
|
'Create party company'
|
||||||
|
pool = Pool()
|
||||||
|
Party = pool.get('party.party')
|
||||||
|
|
||||||
|
company = create_company()
|
||||||
|
with set_company(company):
|
||||||
|
party2, = Party.create([{
|
||||||
|
'name': 'Party 2',
|
||||||
|
}])
|
||||||
|
self.assert_(party2.id)
|
||||||
|
self.assertNotEqual(party2.company, None)
|
||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = trytond.tests.test_tryton.suite()
|
suite = trytond.tests.test_tryton.suite()
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
|
||||||
|
|
Loading…
Reference in a new issue