2026-09-25 18:00:58 +05:30

36 lines
1.1 KiB
Python

from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestProgram(TransactionCase):
def setUp(self):
super().setUp()
self.company = self.env.company
self.campus = self.env['education.campus'].create({
'name': 'North Campus',
'code': 'NCAMP',
'company_id': self.company.id,
})
self.department = self.env['education.department'].create({
'name': 'Engineering',
'code': 'ENG',
'campus_id': self.campus.id,
})
self.level = self.env['education.academic.level'].create({
'name': 'Undergraduate',
'code': 'UG',
'company_id': self.company.id,
})
def test_program_duration(self):
with self.assertRaises(ValidationError):
self.env['education.program'].create({
'name': 'Engineering Degree',
'code': 'ENGD',
'level_id': self.level.id,
'department_id': self.department.id,
'duration': 0,
'duration_unit': 'years',
})