-
Notifications
You must be signed in to change notification settings - Fork 5
Remove unused API endpoints and unused stubbing of Profile API #567
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
base: main
Are you sure you want to change the base?
Remove unused API endpoints and unused stubbing of Profile API #567
Conversation
The `ProfileApiMock#stub_profile_api_list_school_students` helper method stubs the `ProfileApiClient.list_school_students` method. However, none of the examples in these specs result in a call to that method, so we can remove the calls. Removing these redundant calls should make the specs easier to reason about.
The `ProfileApiMock#stub_profile_api_list_school_owners` helper method stubs the `ProfileApiClient.list_school_owners` method. However, none of the examples in these specs result in a call to that method, so we can remove the calls. Removing these redundant calls should make the specs easier to reason about.
This method isn't called from anywhere in the code and, in any case, it's a no-op, because it doesn't call `ProfileApiClient.connection`, so it's safe to remove it.
I noticed that `ProfileApiClient.invite_school_owner` was a no-op, because it didn't call `ProfileApiClient.connection`, so I've removed it as well as the operation and the controller action that called it.
I noticed that `ProfileApiClient.remove_school_owner` was a no-op, because it didn't call `ProfileApiClient.connection`, so I've removed it as well as the operation and the controller action that called it.
I noticed that `ProfileApiClient.remove_school_teacher` was a no-op, because it didn't call `ProfileApiClient.connection`, so I've removed it as well as the operation and the controller action that called it.
@adrian-rpf This addresses one of the issues I mentioned when we chatted the other day. I'd welcome your feedback. |
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 all looks good to me, @floehopper!
I've also double checked CEfE in staging and can't see any way in the UI to do any of the 3 operations you've removed:
- Add an owner
- Remove an owner
- Remove a teacher
Which provides further evidence that this code isn't being exercised.
I started making these changes when I noticed that a bunch of stubbing of
ProfileApiClient
methods was not needed.However, I then noticed that a bunch of
ProfileApiClient
methods are no-ops, because they don't make any use ofProfileApiClient.connection
which is the only code that actually makes any HTTP requests to the Profile API. This in turn led me to remove the API endpoints whose sole purpose was to call these no-op methods along with all the associated code and specs.I can't see any reason to keep unused code in the app - it just makes the codebase harder to navigate for no good reason. If we envisage implementing these endpoints in the future and we're worried about having to write the same code again, we can easily recover it from the git history.
The API endpoints that have been removed are:
POST /api/schools/:school_id/owners
DELETE /api/schools/:school_id/owners/:id
DELETE /api/schools/:school_id/teachers/:id
As far as I can see,
editor-standalone
doesn't make requests to any URLs relating to school owners and the only requests it makes relating to school teachers is ininviteTeacherToSchool()
- see the following references:So it should be safe to merge this.