Files
encoach_backend_new_v3/odoo/addons/website/tests/test_theme.py
Yamen Ahmad 3e83d8d7d5 feat: add complete EnCoach backend — Odoo 19 + all addons
Includes:
- Odoo 19 framework (odoo/)
- 27 custom EnCoach addons (new_project/custom_addons/)
  - encoach_core, encoach_api, encoach_lms_api, encoach_adaptive_api
  - encoach_exam, encoach_taxonomy, encoach_adaptive, encoach_assignment
  - encoach_ai, encoach_ai_grading, encoach_ai_generation, encoach_ai_media
  - encoach_courseware, encoach_communication, encoach_subscription
  - encoach_notification, encoach_approval, encoach_branding
  - encoach_classroom, encoach_registration, encoach_stats
  - encoach_faq, encoach_ticket, encoach_training, encoach_resources
  - encoach_adaptive_ai, encoach_sis
- 21 OpenEduCat Enterprise modules (new_project/enterprise-19/)
- 14 OpenEduCat Community modules (new_project/openeducat_erp-19.0/)
- Configuration: odoo.conf, requirements.txt, scripts
- 200+ REST API endpoints with JWT authentication
- SRS and test documentation

Made-with: Cursor
2026-04-01 17:10:04 +04:00

41 lines
1.6 KiB
Python

from odoo.tests import common, tagged
@tagged('-at_install', 'post_install')
class TestTheme(common.TransactionCase):
def test_theme_remove_working(self):
""" This test ensure theme can be removed.
Theme removal is also the first step during theme installation.
"""
theme_common_module = self.env['ir.module.module'].search([('name', '=', 'theme_default')])
website = self.env['website'].get_current_website()
website.theme_id = theme_common_module.id
self.env['ir.module.module']._theme_remove(website)
def test_02_disable_view(self):
"""This test ensure only one template header can be active at a time."""
website_id = self.env['website'].browse(1)
ThemeUtils = self.env['theme.utils'].with_context(website_id=website_id.id)
ThemeUtils._reset_default_config()
def _get_header_template_key():
return self.env['ir.ui.view'].search([
('key', 'in', ThemeUtils._header_templates),
('website_id', '=', website_id.id),
]).key
self.assertEqual(_get_header_template_key(), 'website.template_header_default',
"Only the default template should be active.")
key = 'website.template_header_vertical'
ThemeUtils.enable_view(key)
self.assertEqual(_get_header_template_key(), key,
"Only one template can be active at a time.")
key = 'website.template_header_hamburger'
ThemeUtils.enable_view(key)
self.assertEqual(_get_header_template_key(), key,
"Ensuring it works also for non default template.")