Skip to content

Commit

Permalink
chore: remove PreventScheduleQuerySetRequest exception
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanttV committed Dec 12, 2024
1 parent 1e3738f commit fefab96
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
19 changes: 0 additions & 19 deletions openedx_filters/learning/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,25 +829,6 @@ class ScheduleQuerySetRequested(OpenEdxPublicFilter):

filter_type = "org.openedx.learning.schedule.queryset.requested.v1"

class PreventScheduleQuerySetRequest(OpenEdxFilterException):
"""
Custom exception to halt the schedule QuerySet request process.
This exception is raised when the filtering process encounters a condition
that prevents further processing of the QuerySet. It returns the original
QuerySet.
"""

def __init__(self, message: str, schedules: QuerySet):
"""
Initialize the PreventScheduleQuerySetRequest with a message and a QuerySet.
Arguments:
message (str): A descriptive error message for the exception.
schedules (QuerySet): The QuerySet of schedules causing the exception.
"""
super().__init__(message, schedules=schedules)

@classmethod
def run_filter(cls, schedules: QuerySet) -> QuerySet:
"""
Expand Down
20 changes: 1 addition & 19 deletions openedx_filters/learning/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,28 +793,10 @@ def test_schedule_requested(self):
Test schedule requested filter.
Expected behavior:
- The filter should return the filterd schedules.
- The filter should return the filtered schedules.
"""
schedules = Mock()

result = ScheduleQuerySetRequested.run_filter(schedules)

self.assertEqual(schedules, result)

@data(
(
ScheduleQuerySetRequested.PreventScheduleQuerySetRequest,
{"schedules": Mock(), "message": "Can't request QuerySet Schedule."}
)
)
@unpack
def test_halt_queryset_request(self, request_exception, attributes):
"""
Test for queryset request exceptions attributes.
Expected behavior:
- The exception must have the attributes specified.
"""
exception = request_exception(**attributes)

self.assertDictContainsSubset(attributes, exception.__dict__)

0 comments on commit fefab96

Please sign in to comment.