Files
edx-platform/openedx/core/djangoapps/enrollments
Deborah Kaplan 77fe61c19c fix: CourseEnrollment list serializer error on deleted Course (#36378)
If a course is deleted or unpublished, the CourseEnrollment list serializer was causing a AttributeErrors when called for a learner who had been enrolled in the formerly-existing course.

Why no test? Because cache invalidation is the worst problem. tl;dr I could create a mock response for the `course_overview` property, but if I mocked up a response to the queryset filter in `CourseEnrollmentsApiListView`, I was effectively guessing that my code worked correctly and then creating a mock response that was an assertion of correctness. That would make any mocked test deceptive; it would appear to test behavior but it would actually just test that I had constructed a mock that passed the test.

I wanted to make an actual test for what would happen if a Course was deleted, so I made one character code fix, and then spent two days unsuccessfully attempting to completely clear out the ModuleStore so I could actually test what would happen in this instance.

IMO an actual verification by hand (which I performed, and it works) was the better part of valor.

in short, cache invalidation aaaaaaaaargh.

FIXES: APER-3913
2025-03-14 08:45:32 -04:00
..
2025-01-30 17:15:33 +05:00
2019-05-28 15:28:15 -04:00
2025-03-12 16:44:14 +00:00
2025-03-12 16:44:14 +00:00

Status: Maintenance

Responsibilities
================
The enrollments app provides basic CRUD functionality and APIs for managing Course-Run enrollments.
Enrollments in Programs is managed by the ``lms/djangoapps/program_enrollments\`` app.

Direction: Keep
===============


Glossary
========

More Documentation
==================