fab7/LAB-devops-capstone-project

Update an account in the service

Opened this issue · 0 comments

fab7 commented

As a User
I need an update service
So that I can add or update a customer account

Details and Assumptions

  • Someone else has already developed the database model and a Python Flask-based REST API with an endpoint to CREATE a customer account.
  • It is implemented using the PUT method and has a path parameter specifying the id of the account to update. The data for the request is sent in the body.
  • The route should be: PUT /accounts/{id}
  • Update should use Account.find() to find the account.
    * It should return a HTTP_404_NOT_FOUND if the account cannot be found.
    * If the account is found, it should call the deserialize() method on the account instance passing in request.get_json() and call the update() method to update the account in the database.
    * It should call the serialize() method on the account instance and return a Python dictionary with a return code of HTTP_200_OK.

Acceptance Criteria

gherkin 
Given an account `id`
When I send a request with new data
Then  It should return the updated account and a return code of 200_OK if the request is completed successfully.
Else It should return 404_NOT_FOUND if the account cannot be found.