24 lines
656 B
Python
24 lines
656 B
Python
from odoo.tests.common import TransactionCase
|
|
from odoo.exceptions import ValidationError
|
|
|
|
|
|
class TestCampus(TransactionCase):
|
|
|
|
def setUp(self):
|
|
super().setUp()
|
|
self.company = self.env.company
|
|
|
|
def test_campus_unique_code(self):
|
|
self.env['education.campus'].create({
|
|
'name': 'Main Campus',
|
|
'code': 'CAMP01',
|
|
'company_id': self.company.id,
|
|
})
|
|
|
|
with self.assertRaises(ValidationError):
|
|
self.env['education.campus'].create({
|
|
'name': 'Another Campus',
|
|
'code': 'CAMP01',
|
|
'company_id': self.company.id,
|
|
})
|