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
125 lines
4.3 KiB
Python
125 lines
4.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.mail.tests.common import mail_new_test_user, MailCase
|
|
|
|
|
|
class SlidesCase(MailCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
super(SlidesCase, cls).setUpClass()
|
|
|
|
cls.env.ref('base.user_admin').write({
|
|
'email': 'mitchell.admin@example.com',
|
|
})
|
|
|
|
cls.user_officer = mail_new_test_user(
|
|
cls.env,
|
|
email='officer@example.com',
|
|
groups='base.group_user,website_slides.group_website_slides_officer',
|
|
login='user_officer',
|
|
name='Ophélie Officer',
|
|
notification_type='email',
|
|
)
|
|
|
|
cls.user_manager = mail_new_test_user(
|
|
cls.env,
|
|
email='manager@example.com',
|
|
login='user_manager',
|
|
groups='base.group_user,website_slides.group_website_slides_manager',
|
|
name='Manuel Manager',
|
|
notification_type='email',
|
|
)
|
|
|
|
cls.user_emp = mail_new_test_user(
|
|
cls.env,
|
|
email='employee@example.com',
|
|
groups='base.group_user',
|
|
login='user_emp',
|
|
name='Eglantine Employee',
|
|
notification_type='email',
|
|
)
|
|
|
|
cls.user_portal = mail_new_test_user(
|
|
cls.env,
|
|
email='portal@example.com',
|
|
groups='base.group_portal',
|
|
login='user_portal',
|
|
name='Patrick Portal',
|
|
notification_type='email',
|
|
)
|
|
|
|
cls.user_public = mail_new_test_user(
|
|
cls.env,
|
|
email='public@example.com',
|
|
groups='base.group_public',
|
|
login='user_public',
|
|
name='Pauline Public',
|
|
notification_type='email',
|
|
)
|
|
|
|
cls.customer = cls.env['res.partner'].create({
|
|
'country_id': cls.env.ref('base.be').id,
|
|
'email': 'customer@customer.example.com',
|
|
'phone': '0456001122',
|
|
'name': 'Caroline Customer',
|
|
})
|
|
|
|
cls.channel = cls.env['slide.channel'].with_user(cls.user_officer).create({
|
|
'name': 'Test Channel',
|
|
'channel_type': 'documentation',
|
|
'promote_strategy': 'most_voted',
|
|
'enroll': 'public',
|
|
'visibility': 'public',
|
|
'is_published': True,
|
|
'karma_gen_channel_finish': 100,
|
|
'karma_gen_channel_rank': 10,
|
|
})
|
|
cls.slide = cls.env['slide.slide'].with_user(cls.user_officer).create({
|
|
'name': 'How To Cook Humans',
|
|
'channel_id': cls.channel.id,
|
|
'slide_category': 'document',
|
|
'is_published': True,
|
|
'completion_time': 2.0,
|
|
'sequence': 1,
|
|
})
|
|
cls.category = cls.env['slide.slide'].with_user(cls.user_officer).create({
|
|
'name': 'Cooking Tips for Humans',
|
|
'channel_id': cls.channel.id,
|
|
'is_category': True,
|
|
'is_published': True,
|
|
'sequence': 2,
|
|
})
|
|
cls.slide_2 = cls.env['slide.slide'].with_user(cls.user_officer).create({
|
|
'name': 'How To Cook For Humans',
|
|
'channel_id': cls.channel.id,
|
|
'slide_category': 'document',
|
|
'is_published': True,
|
|
'completion_time': 3.0,
|
|
'sequence': 3,
|
|
})
|
|
cls.slide_3 = cls.env['slide.slide'].with_user(cls.user_officer).create({
|
|
'name': 'How To Cook Humans For Humans',
|
|
'channel_id': cls.channel.id,
|
|
'slide_category': 'document',
|
|
'is_published': True,
|
|
'completion_time': 1.5,
|
|
'sequence': 4,
|
|
'quiz_first_attempt_reward': 42,
|
|
})
|
|
cls.question_1 = cls.env['slide.question'].with_user(cls.user_officer).create({
|
|
'question': 'How long should be cooked a human?',
|
|
'slide_id': cls.slide_3.id,
|
|
})
|
|
cls.answer_1 = cls.env['slide.answer'].with_user(cls.user_officer).create({
|
|
'question_id': cls.question_1.id,
|
|
'text_value': "25' at 180°C",
|
|
'is_correct': True,
|
|
})
|
|
cls.answer_2 = cls.env['slide.answer'].with_user(cls.user_officer).create({
|
|
'question_id': cls.question_1.id,
|
|
'text_value': "Raw",
|
|
'is_correct': False,
|
|
})
|