Debian Codegraph @

addons/hr_timesheet/tests/test_timesheet_import_template.py

raw
1 from odoo.tests import TransactionCase, tagged
2
3
4 @tagged("post_install", "-at_install")
5 class TestHrTimesheetImportTemplate(TransactionCase):
6
7 def setUp(self):
8 super().setUp()
9 self.AccountLine = self.env['account.analytic.line']
10
11 def fetch_template_for_timesheet(self, is_timesheet):
12 return self.AccountLine.with_context(is_timesheet=is_timesheet).get_import_templates()
13
14 def test_import_template(self):
15 template = self.fetch_template_for_timesheet(True)
16 self.assertEqual(len(template), 1)
17 self.assertEqual(
18 template[0]['template'], '/hr_timesheet/static/xls/timesheets_import_template.xlsx',
19 )
20 template = self.fetch_template_for_timesheet(False)
21 self.assertEqual(template, [])
22 template = self.fetch_template_for_timesheet(None)
23 self.assertEqual(template, [])