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

feat: add seeding data endpoint #1231

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

abijay440
Copy link

Title: Add Seeding Endpoint for Dummy User Data

Description

Description

This pull request introduces a new endpoint, /seed-users, to facilitate the addition of dummy user data into the players table during development and testing. This endpoint allows developers to quickly populate the database with fake users, enabling easier testing of features that rely on user data.

Related Issue (Link to issue ticket)

(#1037)

Motivation and Context

During development and testing, it is often necessary to have a populated database with realistic user data. Manually creating users through the standard registration process can be time-consuming. This seeding endpoint streamlines this process, allowing developers to quickly populate the database with dummy users for testing purposes.

How Has This Been Tested?

The new endpoint has been tested using with swagger fastapi docs and postman. The following steps were taken:

A POST request was sent to /seed with a JSON body specifying the number of users to seed.
The response was verified to ensure a successful status code (200) and a message indicating the number of users created.
The users table in the database was checked to confirm the insertion of the specified number of dummy users.
The endpoint was tested with varying numbers of users to ensure it functions correctly across different scenarios.
Error handling was tested by sending invalid data, ensuring the endpoint returns appropriate error messages.
Pytest for the the endpoint checked out

Screenshots (if appropriate - Postman, etc):

with postman

curl -X 'POST' \
  'http://127.0.0.1:8000/api/v1/seed?num_users=10' \
  -H 'accept: application/json' \
  -d ''

Expected result

{
  "status": "success",
  "status_code": 200,
  "message": "10 users and organizations seeded successfully.",
  "data": {
    "users": [
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]",
      "[email protected]"
    ]
  }
}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [X ] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [ X] My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • [ X] I have read the CONTRIBUTING document.
  • [ X] I have added tests to cover my changes.
  • [ X] All new and existing tests passed.

facilitating easy dev by dummy data addition during development and testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant