Metatron_Student_ERP/test_rules.py

15 lines
601 B
Python

import re
with open('addons/education_lms/tests/test_education_lms.py', 'r') as f:
text = f.read()
text = text.replace(
""" all_courses = self.env['education.lms.course'].with_user(self.user_student_a).search([])""",
""" rules = self.env['ir.rule'].with_user(self.user_student_a)._get_rules('education.lms.course', 'read')
print(f"\\nDEBUG APPLIED RULES FOR STUDENT A: {rules}")
all_courses = self.env['education.lms.course'].with_user(self.user_student_a).search([])"""
)
with open('addons/education_lms/tests/test_education_lms.py', 'w') as f:
f.write(text)