feat: Added test for program_enrollment

This commit is contained in:
scmmishra 2019-03-14 15:44:01 +05:30
parent e3b7e1381d
commit 21823f5f66
2 changed files with 17 additions and 2 deletions

View File

@ -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()

View File

@ -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'])