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
Deprecate /v2/sections/:section_id/students, update consumer #22740
Conversation
My only concern is that |
@@ -38,7 +38,7 @@ class PrintCertificates extends Component { | |||
}; | |||
|
|||
onClickPrintCerts = () => { | |||
$.ajax(`/v2/sections/${this.props.sectionId}/students`).done(result => { | |||
$.ajax(`/dashboardapi/sections/${this.props.sectionId}/students`).done(result => { | |||
const names = result.map(student => student.name); | |||
this.setState({names}, this.submitForm); |
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.
Any testing for PrintCertificates
or anything that confirms this action still works as expected?
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.
currently there is this unit test, which mocks the return value for the component, so it doesn't test the endpoint itself. there are also unit tests on GET /dashboardapi/sections/:section_id/students
, but no integration tests that i could find for PrintCertificates
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.
+1, please verify PrintCertificates some way before merging (not just in production after)
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.
This seems like a good approach. Given the issue that @Erin007 mentioned, it could be a good idea to check that PrintCertificates works in production after this ships.
There is some documentation at https://github.com/code-dot-org/code-dot-org/blob/staging/docs/account-management-api.md pointing toward the /v2/sections APIs, so it would be nice to update or at least deprecate those at some point.
@Erin007 , to address your other concern of hidden dependencies on this route -- searching the repo for /v2/sections
, the only other production code I see referring to it is in apps/src/templates/manageStudents/ShowSecret.jsx, which is pointing to the /update route. While it's possible that someone is constructing a url without explicitly writing /v2/sections
, it seems like a best-effort search for these kinds of references is probably a good enough precaution.
@davidsbailey thanks for pointing out the documentation--i'm changing a lot of endpoints in that area, so i'll add a follow-up task to update that. also, you mentioned that |
@madelynkasula that's awesome, we're so close to getting rid of /v2/sections ! 🔥 |
…rmat for component
@Erin007 @davidsbailey i added a feature test to make sure basically, it checks that |
sounds good, thanks for adding that! |
GET /dashboardapi/sections/:section_id/students
already existed, so this PR:PrintCertificates
) to point to dashboard instead of pegasus