diff --git a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py index c26e89920b0..c6cbee1b75a 100644 --- a/erpnext/education/doctype/program_enrollment/test_program_enrollment.py +++ b/erpnext/education/doctype/program_enrollment/test_program_enrollment.py @@ -6,7 +6,21 @@ from __future__ import unicode_literals import frappe import unittest -# test_records = frappe.get_test_records('Program Enrollment') +from erpnext.education.doctype.student.test_student import create_student +from erpnext.education.doctype.student.test_student import get_student +from erpnext.education.doctype.program.test_program import make_program_and_linked_courses +from erpnext.education.doctype.course_activity.test_course_activity import make_course_activity class TestProgramEnrollment(unittest.TestCase): - pass + + def setUp(self): + create_student({"first_name": "_Test Name", "last_name": "_Test Last Name", "email": "_test_student@example.com"}) + make_program_and_linked_courses("_Test Program 1", ["_Test Course 1", "_Test Course 2"]) + + def test_create_course_enrollments(self): + student = get_student("_test_student@example.com") + enrollment = student.enroll_in_program("_Test Program 1") + course_enrollments = student.get_all_course_enrollments() + self.assertTrue("_Test Course 1" in course_enrollments.keys()) + self.assertTrue("_Test Course 2" in course_enrollments.keys()) + frappe.db.rollback() \ No newline at end of file diff --git a/erpnext/education/doctype/student/test_student.py b/erpnext/education/doctype/student/test_student.py index b319624dbdb..8610edbf282 100644 --- a/erpnext/education/doctype/student/test_student.py +++ b/erpnext/education/doctype/student/test_student.py @@ -40,6 +40,7 @@ class TestStudent(unittest.TestCase): course_enrollments = student.get_all_course_enrollments() self.assertTrue("_Test Course 1" in course_enrollments.keys()) self.assertTrue("_Test Course 2" in course_enrollments.keys()) + frappe.db.rollback() def create_student(student_dict): student = get_student(student_dict['email'])