Conversation
hasnain095
commented
Apr 4, 2023
- Added test for user token
- scoped the create_non_superuser test to session
|
Closed previous pull request, this resolves issue #49 |
| return {"Authorization": f"Bearer {access_token}"} | ||
|
|
||
|
|
||
| @pytest.fixture() |
There was a problem hiding this comment.
Facing an issue when changing this fixture's scope to "session", the user_token_header fixture is function scoped and causes a ScopeMismatch error. If we set the scope of user_token_header as "session" too, then it causes an issue with accessing the "function" scoped fixture "client" with "session" scoped fixture "create_non_superuser".
My opinion is to create a class, and scope all related fixtures to "class". This way we can add any test related to the users into that class.
There was a problem hiding this comment.
The client fixture can be session as well.
There was a problem hiding this comment.
That leads to making the "session" and "connection" fixtures be scoped to the session. I've made these changes already, and all tests passed.
💚 Upgrade black to fix pipeline (Kludex#78)
…api-microservices into feat/add-user-token-test
|
| GitGuardian id | Secret | Commit | Filename | |
|---|---|---|---|---|
| - | Generic Password | b68e839 | users/tests/conftest.py | View secret |
| - | Generic Password | 76e806e | users/tests/conftest.py | View secret |
| - | Generic Password | 43d5267 | users/tests/conftest.py | View secret |
| - | Generic Password | eabf791 | users/tests/conftest.py | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Our GitHub checks need improvements? Share your feedbacks!
|
Considering adding FactoryBoy to avoid GitGuardian Security Check errors. |
| hashed_password = get_password_hash(password) | ||
| result = await session.execute(select(User).where(User.email == email)) | ||
| user: Optional[User] = result.scalars().first() | ||
| if user is None: |
There was a problem hiding this comment.
This is never going to happen cause there will be a rollback on each test.
Sorry, I didn't notice before.
|
@Kludex can we close this PR or you want some other changes? |
This cannot happen: #80 (comment) Because we rollback, so we need to remove that conditional 👀 |
|
Should be fixed now |
|
@Kludex can we close this now? |