From 2566818c1937a408a617136e1de4aab9dc2fe5de Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 15 Mar 2022 11:51:13 -0400 Subject: [PATCH] Add test case to tests/test_course.py Was missing the test case when there were no student modules in the course. We want to make sure our "empty set" handling is correct --- tests/test_course.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_course.py b/tests/test_course.py index b2266df8..2a42485b 100644 --- a/tests/test_course.py +++ b/tests/test_course.py @@ -118,3 +118,11 @@ def test_enrollments_with_student_modules(self): course = Course(self.course_overview.id) found_ce = course.enrollments_with_student_modules() assert set(found_ce) == set(ce[:2]) + + def test_enrollments_with_student_modules_but_no_student_modules(self): + ce = [CourseEnrollmentFactory(course_id=self.course_overview.id) + for _ in range(3)] + + course = Course(self.course_overview.id) + assert not course.student_modules + assert not course.enrollments_with_student_modules()