This repository contains the code for the Python/Flask Codility task which Codility didn't seem to accept.
There are PyTest tests that test the scenarios described in the task.
Additionally, there is a multi-stage Dockerfile that creates a container that runs the tests, or runs the Flask server.
The Docker container uses Python 3.8.5 and Flask 2.1.2 as specified in the Codility task.
Please note that I mocked the save() function, since the described Codility save() function wasn't standard.
$ pip3 install pytest flask=='2.1.2'
$ python3 -m pytest -v
$ docker build -t semperis --target test .
$ docker run semperis
$ docker build -t semperis --target production .
$ docker run -p 5000:5000 semperis
Works with both the containerized and non-containerized versions.
curl -XPOST http://127.0.0.1:5000/users -H 'Content-Type: application/json' -d '{"name":"My Name","age":38}'