Adding Test Utils
This commit is contained in:
parent
c51f738b03
commit
6663ca1d7f
@ -10,3 +10,11 @@ import unittest
|
|||||||
|
|
||||||
class TestCourse(unittest.TestCase):
|
class TestCourse(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def make_course(name):
|
||||||
|
course = frappe.get_doc({
|
||||||
|
"doctype": "Program",
|
||||||
|
"course_name": name,
|
||||||
|
"course_code": name
|
||||||
|
}).insert()
|
||||||
|
return course.name
|
||||||
@ -2,6 +2,7 @@
|
|||||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
from erpnext.education.doctype.course.test_course import make_course
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
@ -10,3 +11,27 @@ import unittest
|
|||||||
|
|
||||||
class TestProgram(unittest.TestCase):
|
class TestProgram(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def make_program(name):
|
||||||
|
program = frappe.get_doc({
|
||||||
|
"doctype": "Program",
|
||||||
|
"program_name": name,
|
||||||
|
"program_code": name,
|
||||||
|
"is_published": True,
|
||||||
|
"is_featured": True,
|
||||||
|
}).insert()
|
||||||
|
return program.name
|
||||||
|
|
||||||
|
def make_program_and_linked_courses(program_name, course_name_list):
|
||||||
|
try:
|
||||||
|
program = frappe.get_doc("Program", program_name)
|
||||||
|
except frappe.DoesNotExistError:
|
||||||
|
make_program(program_name)
|
||||||
|
program = frappe.get_doc("Program", program_name)
|
||||||
|
course_list = [make_course(course_name) for course_name in course_name_list]
|
||||||
|
for course in course_list:
|
||||||
|
program.append("courses", {"course": course})
|
||||||
|
program.save()
|
||||||
|
return program.name
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,6 @@ class Student(Document):
|
|||||||
student_user.save()
|
student_user.save()
|
||||||
self.user = student_user.name
|
self.user = student_user.name
|
||||||
self.save()
|
self.save()
|
||||||
frappe.publish_realtime('enroll_student_progress', {"progress": [4, 4]}, user=frappe.session.user)
|
|
||||||
update_password_link = student_user.reset_password()
|
update_password_link = student_user.reset_password()
|
||||||
print(update_password_link)
|
print(update_password_link)
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,12 @@
|
|||||||
# Copyright (c) 2015, Frappe Technologies and Contributors
|
# Copyright (c) 2015, Frappe Technologies and Contributors
|
||||||
# See license.txt
|
# See license.txt
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
from frappe.test_runner import make_test_records
|
||||||
|
from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
# test_records = frappe.get_test_records('Student')
|
test_records = frappe.get_test_records('Student')
|
||||||
|
|
||||||
class TestStudent(unittest.TestCase):
|
class TestStudent(unittest.TestCase):
|
||||||
pass
|
pass
|
||||||
|
|||||||
0
erpnext/www/test_lms.py
Normal file
0
erpnext/www/test_lms.py
Normal file
Loading…
x
Reference in New Issue
Block a user