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:updating an user with empty username and name gives an error message #695

Closed
wants to merge 2 commits into from

Conversation

rashikaqureshi
Copy link
Contributor

@rashikaqureshi rashikaqureshi commented Jul 21, 2020

while updating user details if the username or name is empty. then added an error message.
Fixes #598
Tested these scenarios. Earlier for these scenarios error message was - user was updated successfully.
Now populating a different error message. Hence receiving errors.

Screenshot 2020-07-21 21 17 50
Screenshot 2020-07-21 21 20 39
Screenshot 2020-07-21 21 24 26
Screenshot 2020-07-21 21 25 08

Code/Quality Assurance Only

  • Bugfix (non-breaking change which fixes an issue)
  • My PR follows the style guidelines of this project
  • I have performed a self-review of my own code or materials

Code/Quality Assurance Only

  • My changes generate no new warnings
  • [ X] New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Jul 31, 2020

Codecov Report

Merging #695 into develop will increase coverage by 0.02%.
The diff coverage is 96.87%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #695      +/-   ##
===========================================
+ Coverage    95.84%   95.86%   +0.02%     
===========================================
  Files           95       95              
  Lines         5200     5230      +30     
===========================================
+ Hits          4984     5014      +30     
  Misses         216      216              
Impacted Files Coverage Δ
app/api/validations/user.py 72.05% <ø> (ø)
app/api/dao/user.py 85.43% <87.50%> (+0.35%) ⬆️
app/messages.py 100.00% <100.00%> (ø)
tests/users/test_api_update_user.py 99.18% <100.00%> (+0.19%) ⬆️

@rashikaqureshi rashikaqureshi force-pushed the update_user branch 2 times, most recently from 7c5a31b to 266c429 Compare August 6, 2020 17:49
@vj-codes vj-codes added the Status: Needs Review PR needs an additional review or a maintainer's review. label Aug 13, 2020
@vj-codes
Copy link
Member

@anitab-org/coding-team This PR needs review. Thanks!

@isabelcosta isabelcosta requested a review from SanketDG August 28, 2020 22:24
Copy link
Contributor

@SanketDG SanketDG left a comment

Choose a reason for hiding this comment

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

Some basic style changes

if data["name"]:
user.name = data["name"]
else:
return messages.NAME_FIELD_IS_MISSING,HTTPStatus.OK
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd rewrite this as:

try:
    user.name = data["name"]
except KeyError:
    return ....

@devkapilbansal
Copy link
Member

@rashikaqureshi please do the changes as requested

@vj-codes
Copy link
Member

@rashikaqureshi Closing the PR due to no update response and inactivity.
Thank you for your contribution 🎉

@vj-codes vj-codes closed this Dec 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review PR needs an additional review or a maintainer's review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating an user with empty username and name should give an error message
4 participants