-
Notifications
You must be signed in to change notification settings - Fork 134
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
Feature to deactivate a user #150
Feature to deactivate a user #150
Conversation
|
||
if schema.confirmation == False: | ||
raise HTTPException(400, 'Confirmation required to deactivate account') | ||
|
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.
A proper confirmation should be done by sending the user an email with a deactivation link
Boss @zxenonx what do you think?
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.
I had that before but the person working on adding the emailing template to the database doesn't have it ready so I was told to implement what I had, that a central service would be used for emailing
The endpoint to even send the email was available but the person too could not proceed without the one adding the templates to the database.
Also, the confirmation email would be sent after the account has been deactivated successfully.
@Dev-wonderful
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.
I was the one who said you should implement what you have. Anyway, I hope the confirmation would allow the user revert the deactivation with a time limit, since you have decided to deactivate successfully before sending a confirmation
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.
Okay
Let me see what I can do about that as quickly as possible
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.
@Dev-wonderful I have implemented the changes
…thon_fastapi_web into auth-deactivate-user
tests/v1/test_user_deactivation.py
Outdated
test_db_name = 'test_fastapi_db' | ||
test_db_pw = 'postgres' | ||
SQLALCHEMY_DATABASE_URL = f"postgresql+psycopg2://postgres:{test_db_pw}@localhost:5432/{test_db_name}" | ||
engine = create_engine(SQLALCHEMY_DATABASE_URL) | ||
TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) | ||
|
||
def override_get_db(): | ||
db = TestingSessionLocal() | ||
try: | ||
yield db | ||
finally: | ||
db.close() | ||
|
||
app.dependency_overrides[get_db] = override_get_db |
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.
Find out how to mock db calls
Description
The changes I have made are to successfully deactivate a user's account. Proper checks are made to ensure that the user account is successfully deactivated, and errors are properly handled
Related Issue (Link to issue ticket)
Link to issue
Motivation and Context
The change is required because users can decide to deactivate their account at any point in time while using the application. This change caters to that.
How Has This Been Tested?
I tested this change in Postman. I also tested in my development environment using pytest. I tested for the following scenarios:
Screenshots (if appropriate - Postman, etc):
Types of changes
Checklist: