odex30_standard/exp_payroll_loans/tests/test_payroll_loans.py

64 lines
2.4 KiB
Python

# -*- coding: utf-8 -*-
from odoo.tests import TransactionCase, tagged
@tagged('post_install', '-at_install')
class TestExpPayrollLoans(TransactionCase):
"""Test cases for exp_payroll_loans module"""
@classmethod
def setUpClass(cls):
super().setUpClass()
# Create test employee
cls.employee = cls.env['hr.employee'].create({
'name': 'Test Employee Loans',
})
def test_01_loan_salary_advance_model_exists(self):
"""Test that hr.loan.salary.advance model is accessible"""
Model = self.env['hr.loan.salary.advance']
self.assertTrue(Model, "hr.loan.salary.advance model should exist")
def test_02_loan_salary_advance_has_monthly_salary(self):
"""Test that hr.loan.salary.advance has monthly_salary field"""
Model = self.env['hr.loan.salary.advance']
self.assertIn(
'monthly_salary',
Model._fields,
"hr.loan.salary.advance should have monthly_salary field"
)
def test_03_loan_request_type_model_exists(self):
"""Test that loan.request.type model is accessible"""
Model = self.env['loan.request.type']
self.assertTrue(Model, "loan.request.type model should exist")
def test_04_loan_request_type_has_career_level_ids(self):
"""Test that loan.request.type has career_level_ids field"""
Model = self.env['loan.request.type']
self.assertIn(
'career_level_ids',
Model._fields,
"loan.request.type should have career_level_ids Many2many field"
)
def test_05_payslip_loans_model_exists(self):
"""Test that payslip.loans model is accessible"""
Model = self.env['payslip.loans']
self.assertTrue(Model, "payslip.loans model should exist")
def test_06_payslip_loans_has_loan_id(self):
"""Test that payslip.loans has loan_id field"""
Model = self.env['payslip.loans']
self.assertIn(
'loan_id',
Model._fields,
"payslip.loans should have loan_id Many2one field"
)
def test_07_reconcile_leaves_model_exists(self):
"""Test that reconcile_leaves model is accessible if defined"""
# Check if reconcile_leaves adds any fields to existing models
# This is a basic check for module loading
self.assertTrue(True, "Module loaded successfully")