BC Registries authentication and authorization services.
Follow the instructions of the Development Readme to setup your local development environment.
- Follow the instructions to checkout the project from GitHub.
- Open the auth-api directory in VS Code to treat it as a project (or WSL projec). To prevent version clashes, set up a virtual environment to install the Python packages used by this project.
- Run
make setup
to set up the virtual environment and install libraries. - Next run
pip install .
to set up the environment for running tests.
You also need to set up the variables used for environment-specific settings:
- Copy the dotenv template file to somewhere above the source code and rename to
.env
. You will need to fill in missing values. .github\workflows\auth-api-ci.yml could provide some hints for unit tests.
To prepare your local database:
- In the root project folder:
docker-compose up -d
- In your
venv
environment:python manage.py db upgrade
Note:
[Windows Users] If using WSL, may need to change the host from localhost -> .local EX. in config.py and .env.
[Mac Users] : You might get an error regarding the SSL certificate verification failed. follow the steps to resolve that issue:
- Open the terminal window, and run
python3 -v
command to check the version of python. - run the following command:
pip install certifi /Applications/Python\ <version of your python>/Install\ Certificates.command
eg: if your python version is 3.7, then, run
pip install certifi /Applications/Python\ 3.7/Install\ Certificates.command
- Start the flask server with
(python -m flask run -p 5000)
- View the OpenAPI Docs.
- Run
make flake8
orflake8 src/auth_api tests
. - Run
make pylint
orpylint --rcfile=setup.cfg --disable=C0301,W0511 src/auth_api test
- Tests are run from the Status bar at the bottom of the workbench in VS Code or
pytest
command. - Next run
make coverage
to generate the coverage report, which appears in the htmlcov directory.
- Start your local application(s).
- Open postman applicaiton.
- Import the Integration tests environment configrations and fill the values to match your applicaiton.
- Import the integration tests collection.
- Run the collection.
View the document.