Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Apr 11, 2024
1 parent 8edfd87 commit e94df6a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions openedx_filters/learning/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
CourseUnenrollmentStarted,
DashboardRenderStarted,
InstructorDashboardRenderStarted,
ORASubmissionViewRenderStarted,
StudentLoginRequested,
StudentRegistrationRequested,
VerticalBlockChildRenderStarted,
Expand Down Expand Up @@ -546,6 +547,36 @@ def test_halt_instructor_dashboard_render(self, dashboard_exception, attributes)

self.assertDictContainsSubset(attributes, exception.__dict__)

def test_ora_submission_view_render_started(self):
"""
Test ORASubmissionViewRenderStarted filter behavior under normal conditions.
Expected behavior:
- The filter must have the signature specified.
- The filter should return context and template_name in that order.
"""
result = ORASubmissionViewRenderStarted.run_filter(self.context, self.template_name)

self.assertTupleEqual((self.context, self.template_name,), result)

@data(
(
ORASubmissionViewRenderStarted.RenderInvalidTemplate,
{"context": {"course": Mock()}, "template_name": "custom-template.html"},
),
)
@unpack
def test_halt_ora_submission_view_render(self, dashboard_exception, attributes):
"""
Test for the ora submission view exceptions attributes.
Expected behavior:
- The exception must have the attributes specified.
"""
exception = dashboard_exception(message="You can't access the view", **attributes)

self.assertDictContainsSubset(attributes, exception.__dict__)


class TestCohortFilters(TestCase):
"""
Expand Down

0 comments on commit e94df6a

Please sign in to comment.