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

Issue#86 PUT /user/personal_background api endpoint and tests #87

Conversation

mtreacy002
Copy link
Member

@mtreacy002 mtreacy002 commented Jul 16, 2020

Description

Allow user to update their personal background data

Fixes #86

Type of Change:

  • Code

Code/Quality Assurance Only

  • New feature (non-breaking change which adds functionality pre-approved by mentors)

How Has This Been Tested?

  • Login as a user that has no perrsonal background data and get personal details (GET /user/personal_details) so the user_id is saved to cookie.
  • send PUT /user/personal_background request and on successful create, see response 201 Created as per screenshot below

Screen Shot 2020-08-03 at 9 57 43 pm

  • now test update by modifying the personal background. On successful update see response 200 OK as per screenshot below

Screen Shot 2020-08-03 at 9 58 06 pm

  • with invalid new personal background data payload

Screen Shot 2020-08-03 at 10 19 20 pm

Checklist:

  • 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
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@mtreacy002 mtreacy002 requested a review from a team July 16, 2020 14:39
@mtreacy002 mtreacy002 self-assigned this Jul 16, 2020
@mtreacy002 mtreacy002 added Category: Coding Changes to code base or refactored code that doesn't fix a bug. Program: GSOC Related to work completed during the Google Summer of Code Program. labels Jul 16, 2020
@mtreacy002 mtreacy002 added this to the GSoc Coding Phase 2 milestone Jul 16, 2020
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . Here's the PR for PUT /user/personal_background api endpoint and tests. please provide feedback whenever you're available. Thanks

@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from fe3dba7 to 598bd04 Compare July 18, 2020 13:26
ramitsawhney27
ramitsawhney27 previously approved these changes Jul 19, 2020
Copy link

@ramitsawhney27 ramitsawhney27 left a comment

Choose a reason for hiding this comment

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

Looks good. I like the very detailed docstrings, makes the review and understanding much easier for me!

@mtreacy002
Copy link
Member Author

Looks good. I like the very detailed docstrings, makes the review and understanding much easier for me!

thank you @ramitsawhney27 for your kind feedback.

@mtreacy002 mtreacy002 added the Status: On Hold Issue or PR needs more info, a discussion, a review or approval from a Maintainer/Code Owner. label Jul 19, 2020
@mtreacy002 mtreacy002 changed the title Issue#86 PUT /user/personal_background api endpoint and tests WIP | Issue#86 PUT /user/personal_background api endpoint and tests Jul 19, 2020
@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from 598bd04 to 0ecf6a9 Compare July 22, 2020 11:40
@mtreacy002 mtreacy002 changed the title WIP | Issue#86 PUT /user/personal_background api endpoint and tests Issue#86 PUT /user/personal_background api endpoint and tests Jul 22, 2020
@mtreacy002 mtreacy002 removed the Status: On Hold Issue or PR needs more info, a discussion, a review or approval from a Maintainer/Code Owner. label Jul 22, 2020
@mtreacy002 mtreacy002 requested review from ramitsawhney27 and a team July 22, 2020 11:41
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've modified the background enum logic on backend as discussed in the last BIT weekly meeting. Please re-review once you have time. Thanks

@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from 0ecf6a9 to 09217fa Compare July 22, 2020 14:21
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just force pushed changes to add other fields for physical and mental ability as well as socio-economic status

@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from 09217fa to 432933c Compare July 26, 2020 09:03
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I'vee resolved the mergee conflicts and applied bug fixes discussed on zulip post and issue #94 (temporary solution for local environment only).

ramitsawhney27
ramitsawhney27 previously approved these changes Jul 29, 2020
@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from 432933c to 0e1fb7e Compare August 3, 2020 12:05
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've refactor this PR to use only one API endpoint PUT /user/personal_background for both create and update user personal background information. Please review when you have time.

@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch 2 times, most recently from 5ca9e20 to 8164dcb Compare August 3, 2020 14:24
@mtreacy002 mtreacy002 requested review from ramitsawhney27 and a team August 3, 2020 14:32
Copy link

@foongminwong foongminwong left a comment

Choose a reason for hiding this comment

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

The changes made in this PR were tested locally. Following are the results:

  1. Code review - Done

  2. All possible responses were tested as below:

    • Test PR 87 (Create non-existing personal background)
      Screenshot/gif/url:

      test-bit-backend-pr-87-create

      Expected Result: As a user, I should be able to create personal background using PUT /user/personal_background
      Actual Result:

    • Test PR 87 (Update existing personal background)
      Screenshot/gif/url:

      test-bit-backend-pr-87-update

      Expected Result: As a user, I should be able to update existing personal background using PUT /user/personal_background
      Actual Result: Same as expected

  3. OS Version: Windows 10

  4. Tested JSON:

{
  "gender": "Prefer not to say",
  "age": "Prefer not to say",
  "ethnicity": "Prefer not to say",
  "sexual_orientation": "Prefer not to say",
  "religion": "Prefer not to say",
  "physical_ability": "Prefer not to say",
  "mental_ability": "Prefer not to say",
  "socio_economic": "Prefer not to say",
  "highest_education": "Prefer not to say",
  "years_of_experience": "Prefer not to say",
  "gender_other": "Prefer not to say",
  "ethnicity_other": "Prefer not to say",
  "sexual_orientation_other": "Prefer not to say",
  "religion_other": "Prefer not to say",
  "physical_ability_other": "Prefer not to say",
  "mental_ability_other": "Prefer not to say",
  "socio_economic_other": "Prefer not to say",
  "highest_education_other": "Prefer not to say",
  "is_public": true
}

foongminwong
foongminwong previously approved these changes Aug 9, 2020
Fix bug on testing

fix typo requests.put mock patch

Remove POST user/personal_background

Remove Create personal background dao
…ints

Refactored Background enum logic

Refactor test to include other fields for physical, mental ability and socio economic

Remove POST api endpoint for create user personal background

Remove Create personal background dao
Refactored background enum  logic for update personal background

Add other fields for physical, mental ability and socio economic

Fix: bug on user_id not retrieved error message and setting

Refactor POST PUT update personal background to one api endpoint PUT
@mtreacy002 mtreacy002 force-pushed the issue#86-update-user-personal-background-api-and-tests branch from 8164dcb to 8b14e21 Compare August 11, 2020 00:09
@mtreacy002
Copy link
Member Author

Update @anitab-org/bridgeintech-maintainers . I've just resolved the merge conflict on this PR. Please re-approve and only merge this PR after the PR #85 which is this PR's blocker is merged to develop. Thanks

@ramitsawhney27 ramitsawhney27 merged commit 5c9f981 into anitab-org:develop Aug 11, 2020
@mtreacy002 mtreacy002 deleted the issue#86-update-user-personal-background-api-and-tests branch August 30, 2020 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Coding Changes to code base or refactored code that doesn't fix a bug. Program: GSOC Related to work completed during the Google Summer of Code Program.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dev: PUT /user/personal_background api endpoint and test cases
3 participants