fix: fixed failing tests
This commit is contained in:
@@ -8,11 +8,19 @@ class TestExercise(unittest.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
frappe.db.sql('delete from `tabExercise Submission`')
|
frappe.db.sql('delete from `tabExercise Submission`')
|
||||||
frappe.db.sql('delete from `tabExercise`')
|
frappe.db.sql('delete from `tabExercise`')
|
||||||
|
frappe.db.sql('delete from `tabLMS Course`')
|
||||||
|
|
||||||
def new_exercise(self):
|
def new_exercise(self):
|
||||||
|
course = frappe.get_doc({
|
||||||
|
"doctype": "LMS Course",
|
||||||
|
"name": "test-course",
|
||||||
|
"title": "Test Course"
|
||||||
|
})
|
||||||
|
course.insert()
|
||||||
e = frappe.get_doc({
|
e = frappe.get_doc({
|
||||||
"doctype": "Exercise",
|
"doctype": "Exercise",
|
||||||
"name": "test-problem",
|
"name": "test-problem",
|
||||||
|
"course": course.name,
|
||||||
"title": "Test Problem",
|
"title": "Test Problem",
|
||||||
"description": "draw a circle",
|
"description": "draw a circle",
|
||||||
"code": "# draw a single cicle",
|
"code": "# draw a single cicle",
|
||||||
@@ -31,6 +39,8 @@ class TestExercise(unittest.TestCase):
|
|||||||
e = self.new_exercise()
|
e = self.new_exercise()
|
||||||
submission = e.submit("circle(100, 100, 50)")
|
submission = e.submit("circle(100, 100, 50)")
|
||||||
assert submission is not None
|
assert submission is not None
|
||||||
|
assert submission.exercise == e.name
|
||||||
|
assert submission.course == e.course
|
||||||
|
|
||||||
user_submission = e.get_user_submission()
|
user_submission = e.get_user_submission()
|
||||||
assert user_submission is not None
|
assert user_submission is not None
|
||||||
|
|||||||
Reference in New Issue
Block a user