Skip to content

Commit

Permalink
fastapi-migration: Update README about test users
Browse files Browse the repository at this point in the history
This commit includes basic documentation about pre-populated test user accounts.
  • Loading branch information
paulespinosa committed Oct 7, 2024
1 parent 82c4b87 commit 581de6b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ Building with Docker is the simplest option, and debugging applications within t
2. Verify there are no build errors. If there are build errors, reach out to the development team.
3. Open `http://localhost:34828` in any browser to use Home Unite Us.


#### Test Users

For local development, test users already exist when started using Docker.

The password for all test users is `Test123!`.

- 1 Admin: admin@email.com
- 26 Guests: guest[a-z]@email.com (e.g. `guesta@email.com`, `guestb@email.com`, ... `guestz@email.com`)
- 26 Coordinators: coordinator[a-z]@email.com (e.g. `coordinatora@email.com`, `coordinatorb@email.com`, ... `coordinatorz@email.com`)
- 26 Hosts: host[a-z]@email.com (e.g. `hosta@email.com`, `hostb@email.com`, ... `hostz@email.com`)

## Testing Instructions

Testing instructions for each application are in the [backend](./backend/README.md) and [frontend](./frontend/README.md) README files.
45 changes: 41 additions & 4 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,40 @@ Run `python -V` to check the Python version.

[Poetry](https://python-poetry.org/docs/#installation) is used to manage the project dependencies. Follow the [installation instructions](https://python-poetry.org/docs/#installation) to run the CLI globally.

[Docker](https://www.docker.com) is used to run required dependencies for development.

## Usage - Development

### Getting Started

#### Run Required Docker Containers

The API uses PostgreSQL and Moto server as it's basic required services. Using Docker Compose, run these containers prior to running the API using the following command:

```shell
docker compose up -d --build pgadmin motoserver # Runs required docker services: PostgreSQL, Moto Server, pgAdmin4
```

The command above will run three containers. `pgAdmin4` is a convenient tool that wills developers to query the PostgreSQL database.

#### Configuration

The API configuration must be specified before running the application. Configuration variables are specified as entries within a `.env` file located within the `backend` directory. To get started, create a `.env` file within `/backend` and copy the values from `.env.example` into the new `.env` file.

#### Setup and Run - non-Docker version
#### Setup and Run API - non-Docker version

Once the `.env` file has been configured and Poetry is installed, run the following commands in the `backend` directory to install the required development dependencies and run the application.

```shell
poetry install # Installs all dependencies
poetry install # Installs all dependencies

poetry shell # Activates the virtual environment
poetry shell # Activates the virtual environment

poetry run fastapi dev app/main.py # Runs this server in developer mode
# If using a shell use this:
startup_scripts/entrypoint.sh # Creates test users and runs the API in developer mode

# If using Powershell use this:
startup_scripts/entrypoint.ps1 # Creates test users and runs the API in developer mode
```

Your server is now running at:
Expand All @@ -51,11 +67,32 @@ And your API docs at:
http://127.0.0.1:8000/docs
```

pgAdmin4 is available at:
```
http://127.0.0.1:5050/
```

Moto server dashboard is available at:
```
http://127.0.0.1:5000/moto-api
```

To exit the virtual environment, within the shell run:
```shell
exit
```

## Test Users

The `startup_scripts/entrypoint.sh` (or `startup_scripts/entrypoint.ps1` if using Powershell) script creates the following users.

The password for all test users is `Test123!`.

- 1 Admin: admin@email.com
- 26 Guests: guest[a-z]@email.com (e.g. `guesta@email.com`, `guestb@email.com`, ... `guestz@email.com`)
- 26 Coordinators: coordinator[a-z]@email.com (e.g. `coordinatora@email.com`, `coordinatorb@email.com`, ... `coordinatorz@email.com`)
- 26 Hosts: host[a-z]@email.com (e.g. `hosta@email.com`, `hostb@email.com`, ... `hostz@email.com`)

## Conventions

### API Endpoints
Expand Down

0 comments on commit 581de6b

Please sign in to comment.