anitab-org / mentorship-backend

Mentorship System is an application that matches women in tech to mentor each other, on career development, through 1:1 relations during a certain period of time. This is the backend of this system.
https://mentorship-backend-temp.herokuapp.com/
GNU General Public License v3.0
196 stars 449 forks source link

Update user with existing username #1138

Closed diananova closed 2 years ago

diananova commented 3 years ago

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:

Fixes #596

Type of Change:

Code/Quality Assurance Only

How Has This Been Tested?

NEW TESTS

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'?) image

SITUATION 2:

User 12 updates username from string321 to boh12345 Expected: 404 A user with that username already exists image

Checklist:

Code/Quality Assurance Only

codecov[bot] commented 3 years ago

Codecov Report

Merging #1138 (77e8743) into develop (c154317) will increase coverage by 0.00%. The diff coverage is 100.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 Impacted file tree graph

@@           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:
devkapilbansal commented 3 years ago

@diananova are you working on this?

diananova commented 3 years ago

@diananova are you working on this?

Yes

devkapilbansal commented 2 years ago

@diananova there are some errors in checks. Please look into them

vj-codes commented 2 years ago

Closing this PR due to inactivity. Thank you for your contribution @diananova :)