Skip to content
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

Missing test for deleting authenticated users #1168

Conversation

sh-ran
Copy link
Contributor

@sh-ran sh-ran commented Mar 19, 2025

Contributor checklist


Description

Related issue

Copy link

netlify bot commented Mar 19, 2025

Deploy Preview for activist-org canceled.

Name Link
🔨 Latest commit 7168e39
🔍 Latest deploy log https://app.netlify.com/sites/activist-org/deploys/67def45124349b0008d3020c

Copy link
Contributor

Thank you for the pull request! ❤️

The activist team will do our best to address your contribution as soon as we can. If you're not already a member of our public Matrix community, please consider joining! We'd suggest using Element as your Matrix client, and definitely join the General and Development rooms once you're in. Also consider attending our bi-weekly Saturday developer syncs! It'd be great to meet you 😊

Copy link
Contributor

github-actions bot commented Mar 19, 2025

Maintainer Checklist

The following is a checklist for maintainers to make sure this process goes as well as possible. Feel free to address the points below yourself in further commits if you realize that actions are needed :)

  • The TypeScript, pytest and formatting workflows within the PR checks do not indicate new errors in the files changed

  • The Playwright end to end and Zap penetration tests have been ran and are passing (if necessary)

  • The changelog has been updated with a description of the changes for the upcoming release and the corresponding issue (if necessary)

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First PR Commit Check

  • The commit messages for the remote branch of a new contributor should be checked to make sure their email is set up correctly so that they receive credit for their contribution
    • The contributor's name and icon in remote commits should be the same as what appears in the PR
    • If there's a mismatch, the contributor needs to make sure that the email they use for GitHub matches what they have for git config user.email in their local activist repo (can be set with git config --global user.email "GITHUB_EMAIL")

@andrewtavis
Copy link
Member

Do you want to take a first glance at this, @mattburnett-repo? :)

Copy link
Member

@mattburnett-repo mattburnett-repo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if response.status_code == 200:
    delete_response = client.delete(
        path="/v1/auth/delete/",
        data={"pk": user.id}
    )

    assert delete_response.status_code == 200

Overall, looks really good! I would suggest we take out the 'if response.status_code == 200' line. We want the delete to happen / be tested no matter what the rest of the test does.

@sh-ran
Copy link
Contributor Author

sh-ran commented Mar 19, 2025

I will remove the if block and submit again ASAP. Thank you for the suggestion.

@sh-ran
Copy link
Contributor Author

sh-ran commented Mar 19, 2025

So I tried removing the if block and when I ran the tests again, the test fails throwing an assertion error 401. In order for the user to be deleted, the user has be an authenticated user. And the only way I can think of ensuring that only authenticated users can delete is by using that IF block. Unless I am missing something.
I apologise if this is an easy fix and messing this up.

@mattburnett-repo

@mattburnett-repo
Copy link
Member

ah! That makes sense. Let's keep things simple and put the 'if' statement back in.

Thanks for responding so quickly!

@sh-ran
Copy link
Contributor Author

sh-ran commented Mar 19, 2025

Thank you! @mattburnett-repo

Since I have not put in a new PR I am guessing the current PR is good? @andrewtavis

I'll start working on the remaining tests ASAP.
Thank you again.

@andrewtavis
Copy link
Member

Minor change to left justify the function docstrings and break them onto a new line always. I find it makes it easier to read these things when they're all structured in a similar way 😊

Copy link
Member

@andrewtavis andrewtavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the great first contribution here, @sh-ran! Really looking forward to further collaborations with you 😊 And also thanks for the review support, @mattburnett-repo! 🚀

@andrewtavis andrewtavis merged commit 5d56061 into activist-org:main Mar 22, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants