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

✅ Fix backend tests failing if FIRST_SUPERUSER_PASSWORD is not "changethis" #1213

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

swelborn
Copy link

See discussion here: #1135 (reply in thread)

This was changed in the following PR: #632

Changing it back to settings.FIRST_SUPERUSER_PASSWORD makes it work again.

I think the issue is that after this test, the password is changed to something else and the other tests can't authorize.

There was another fix in that discussion here: #1135 (reply in thread)

Don't know what is preferred, let me know.

@swelborn
Copy link
Author

swelborn commented May 24, 2024

Forgot to add...

To reproduce:

  1. Clone master
  2. Edit FIRST_SUPERUSER_PASSWORD in .env to something other than "changethis"
  3. docker compose up
  4. Exec into backend container
  5. run bash ./scripts/test.sh

@alejsdev alejsdev changed the title Fix backend tests failing if FIRST_SUPERUSER_PASSWORD is not "changethis" ✅ Fix backend tests failing if FIRST_SUPERUSER_PASSWORD is not "changethis" Jul 18, 2024
@swelborn
Copy link
Author

Hi @alejsdev. Before I merge, there was another comment here on this: #1135 (comment)

Should we consider this? I think the API functionality is still tested, but the commenter is right that the actual password change isn't really tested...

I think one solution is caching original password, changing it, testing the change, and then resetting it back to the original.

@alejsdev
Copy link
Member

I see, I think it would be better to create a new user and use it to reset his password or using @swelborn approach because changing the password of the first superuser would break the other tests, and using the same password doesn't make much more sense, I think it would be better to refactor this test cc @tiangolo @estebanx64 🤔

@swelborn
Copy link
Author

Hey @javadzarezadeh and @alejsdev - I see that you both approved this. Could merge for now to avoid tests failing for new users, and then refactor a different way with a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants