-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add parent_course query parameter to basic content-metadata endpoint #1026
Conversation
# If ``?parent_course=true`` was passed, exclude course runs. | ||
if self.request.query_params.get('parent_course', False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just "exclude_course_runs" for the parameter name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exclude_course_runs
suggests the only behavior change is that course runs are excluded. But that is untrue for retrieve(), in which case requested course runs are converted to courses (rather than 404 which is what I'd expect based on the name `exclude_course_runs).
That said, I'm still open to alternative names. Maybe "coerce_to_parent_course"?
b61c41d
to
4118412
Compare
0cc5108
to
de1c028
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Approving to unblock. Very cool implementation using the test helper ddt_cross_product
. I learned something new today!
@ddt.data(*ddt_cross_product( | ||
[ | ||
{'request_content_type': COURSE, 'coerce_to_parent_course': False, 'expect_content_type': COURSE}, | ||
{'request_content_type': COURSE, 'coerce_to_parent_course': True, 'expect_content_type': COURSE}, | ||
{'request_content_type': COURSE_RUN, 'coerce_to_parent_course': False, 'expect_content_type': COURSE_RUN}, | ||
{'request_content_type': COURSE_RUN, 'coerce_to_parent_course': True, 'expect_content_type': COURSE}, | ||
], | ||
# Repeat ever test above given different types of identifier input types. | ||
[ | ||
{'request_by_field': 'id'}, | ||
{'request_by_field': 'content_key'}, | ||
{'request_by_field': 'content_uuid'}, | ||
], | ||
)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool implementation, if I am understanding correctly, this ends up being 12 test cases total?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, 12!
de1c028
to
ac3b5e8
Compare
ENT-9840