Filter b2b courseware objects from the v2 courses api #3259
+125
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Closes mitodl/hq#9951
Closes mitodl/hq#9955
Description (What does it do?)
Strips out B2B-related courseware from the
v2/coursesAPI:org_idis specifiedb2b_only, unlessorg_idis specifiedB2B-specific stuff shouldn't be in these anyway unless we're specifically looking for it.
How can this be tested?
Configure a course to have at least one run that's publicly accessible and one that's attached to a contract. Add it to a program that's marked as B2B only, and one that isn't. Then, hit the API: http://mitxonline.odl.local:9080/api/schema/swagger-ui/#/courses/api_v2_courses_list
You should only see the B2B runs if you've specified the org or contract that the run is in. By default, you shouldn't see the B2B run. This should work if you're listing out all the courses, or if you're loading the specific course.
Similarly, for programs, you should only see the B2B program if you've specified an org or contract. (Note that, in this case, you have to specify the
readable_idto get programs as part of the result set. If you don't specify a readable ID, you won't get programs at all.)