-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add tests to UserDeleteView endpoint #935
Add tests to UserDeleteView endpoint #935
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## add-delete-user-endpoint #935 +/- ##
===========================================================
Coverage ? 92.69%
===========================================================
Files ? 279
Lines ? 8301
Branches ? 777
===========================================================
Hits ? 7695
Misses ? 500
Partials ? 106 ☔ View full report in Codecov by Sentry. |
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.
Since I've not seen the code for the endpoint being tested here, I took this as a game, trying to guess how it's implemented and base my comments on that. Therefore the comments should be taken with a bit of salt.
): | ||
api_client.force_authenticate(user) | ||
response = api_client.post( | ||
f"/api/cyberstorm/user/{user.username}/delete/", |
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.
Should we use DELETE
http method instead of POSTing to URL with delete/
at the end?
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.
That would probably be correct, but I'm not sure. I have a slight little memory that I would have asked this from @MythicManiac and that POST
ing would have been the desired way. But can't say for sure.
user2 = UserFactory() | ||
api_client.force_authenticate(user2) | ||
response = api_client.post( | ||
f"/api/cyberstorm/user/{user.username}/delete/", |
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.
If user can only delete their own account, do we need to include the username in the URL? We could read it from the session, since we have to check it matches anyway?
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.
We can do that. But I opted to having the name be in the url as an extra precaution. In addition this way the view can be expanded to handle something like "admins can delete accounts" if the need arises.
fc5cd99
to
0d6682c
Compare
978adaa
to
54a7930
Compare
0d6682c
to
eac5259
Compare
54a7930
to
bc3fe4e
Compare
eac5259
to
8c513d0
Compare
bc3fe4e
to
557c154
Compare
8c513d0
to
4f2cfa1
Compare
557c154
to
20c4f17
Compare
4f2cfa1
to
73f4b22
Compare
20c4f17
to
7a5ea26
Compare
73f4b22
to
6d7cb43
Compare
7a5ea26
to
1cf2069
Compare
6d7cb43
to
de09dfd
Compare
981461a
to
a983b4b
Compare
de09dfd
to
0eab37c
Compare
a983b4b
to
4e5ac17
Compare
0eab37c
to
7c4a8e5
Compare
4e5ac17
to
adc8b88
Compare
7c4a8e5
to
67fb284
Compare
adc8b88
to
7582784
Compare
7582784
to
8357e34
Compare
67fb284
to
e27c47d
Compare
No description provided.