Start the stack ::
$ docker-compose up
Register::
$ curl -H "Content-Type: application/json" localhost:8000/api/register -d "{\"email\":\"[email protected]\",\"password\":\"aaaaaaaaaaaa\"}"
Check the "mail" in docker-compose output ::
"json": {
"to": "[email protected]",
"from": "[email protected]",
"body": "Hello, here is your activation code 1234. Please go to /api/activate"
}
Activate your account ::
$ curl -H "Content-Type: application/json" -u "[email protected]":aaaaaaaaaaaa localhost:8000/api/activate -d "{\"activation_code\":\"1234\"}"
this will override starting command to run pytest with coverage report ::
docker-compose -p tests run -v /var/run/docker.sock:/var/run/docker.sock --rm registration-api sh -c "pip install '.[test]' && coverage run -m pytest && coverage report"
Create a virtualenv and activate it::
$ python3 -m venv venv
$ . venv/bin/activate
Install dependencies::
$ pip install -e .
::
$ docker-compose up database mail
$ export FLASK_APP=main FLASK_ENV=development PGHOST=localhost PGUSER=demo PGPASSWORD=demo PGDATABASE=registration PGPORT=5432 MAIL_URL=http://localhost:8025
$ flask run
Open http://127.0.0.1:5000 in a browser.
::
$ pip install '.[test]'
$ pytest
Please wait until the docker images are downloading !
Run with coverage report::
$ coverage run -m pytest
$ coverage report
$ coverage html # open htmlcov/index.html in a browser