Skip to content

Add backend Python tests for the /user endpoint which creates a new user on the server #28

@rlivings39

Description

@rlivings39

#27 added some testing infrastructure and tests for the authentication system added by issue #2 .

This issue is to add tests for the /user endpoint that will be used to save a new user account in the server & database.

To do this, I'd suggest modifying server/tests/test_authentication.py to

  1. Add a new test function, say def test_new_user(client: FlaskClient), similar to the other functions in that file.
  2. Call client.post in that new function with the right input data to make a request to create a new user.
  3. Ensure that the response status code is a success, e.g. 201
  4. Ensure that you can then log in as that new user by calling the /login endpoint

To experiment with the /user endpoint, and others

  1. Start the Flask server as shown in CONTRIBUTING.md
  2. Open http://127.0.0.1:5000 in your browser and click the link there to get to the API test page
  3. Play with the APIs you're looking to test!

CONTRIBUTING.md also shows how to run tests in your terminal and VSCode

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions