Closed diananova closed 2 years ago
Merging #1138 (77e8743) into develop (c154317) will increase coverage by
0.00%
. The diff coverage is100.00%
.:exclamation: Current head 77e8743 differs from pull request most recent head f72d74e. Consider uploading reports for the commit f72d74e to get more accurate results
@@ Coverage Diff @@
## develop #1138 +/- ##
========================================
Coverage 93.25% 93.26%
========================================
Files 38 38
Lines 2062 2063 +1
========================================
+ Hits 1923 1924 +1
Misses 139 139
Impacted Files | Coverage Δ | |
---|---|---|
app/api/dao/user.py | 85.88% <100.00%> (+0.05%) |
:arrow_up: |
@diananova are you working on this?
@diananova are you working on this?
Yes
@diananova there are some errors in checks. Please look into them
Closing this PR due to inactivity. Thank you for your contribution @diananova :)
Description
Problem: User wants to update profile without updating username but gets error 404: "A user with that username already exists."
Example: My username is Paul123 and my name is Paul. I want to change my name to Jim. I send a PUT /user request to update my profile with payload: { "name": "Jim", "username": "Paul123" } I get a 404 error with message "A user with that username already exists."
Solution:
fetch the new username and check if there is a user with that username in the dbif there is, check that this user's id is equal to current user's id. If they're equal, it's the same user. No need to update anything. If they're different, we should get the 404 error (user already exists).Fixes #596
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
NEW TESTS
test_update_username_same
: when a user tries to update his profile with the same username, he doesn't get an error 404 but a 200 success code.MANUAL TESTING
User with id 12 and username string321 User with id 13 and username boh12345
SITUATION 1:
User 12 updates username from string321 to string321 Expected: no change. 200 success. (We could also add another server response for 'nothing was changed'?)
SITUATION 2:
User 12 updates username from string321 to boh12345 Expected: 404 A user with that username already exists
Checklist:
Code/Quality Assurance Only