All the versions mentioned are the recommended ones.
This project is dependent of the openxeco-core project. It uses the openXeco API
To know how to deploy openXeco, please see:
https://github.com/CybersecurityLuxembourg/openxeco-core/blob/main/README.md#for-development
The project is using the python-dotenv package so you can copy and adjust the local file openxeco-eccc-middleware/oxe-api/.env.example with such content:
.env.example
ENVIRONMENT=dev
JWT_SECRET_KEY=my_secret_developer_key
OPENXECO_API_ENDPOINT=https://api.example.com/
ECCC_API_ENDPOINT=https://eccc.example.com/
ECCC_API_KEY=EXAMPLE_OF_KEY
For Linux:
$ git clone https://github.com/CybersecurityLuxembourg/openxeco-eccc-middleware.git
$ cd openxeco-eccc-middleware/oxe-api
$ cp .env.example .env # Edit accordingly
$ sudo apt install python3-venv -y
$ python3 -m venv venv
$ source ./venv/bin/activate
$ pip install -U pip setuptools
$ pip install -U -r requirements.txt
For Windows
> cd %USERPROFILE%\openxeco-eccc-middleware\oxe-api
> python -m venv venv
> .\venv\Scripts\activate
> pip install -U pip setuptools
> pip install -U -r requirements.txt
You have to make sure that the python environment is active, to double check:
$ echo ${VIRTUAL_ENV}
/home/luser/openxeco-eccc-middleware/oxe-api/venv
If not, repeat the steps above.
$ python app.py
To run a single test
$ python -m unittest test/resource/entity/test_get_entity.py
To run the whole set use the command below. (Here --buffer or -b is used to discard the output on a successful test run.)
$ python -m unittest --buffer
Run the test coverage report (with the venv activated).
$ coverage run --source=resource,utils,db,decorator -m unittest discover && coverage report
Run the test coverage report (with the venv activated) for a specific package.
$ coverage run --source=resource/user -m unittest discover test/resource/user/ && coverage report
Run the test coverage report and generate in HTML (with the venv activated).
$ coverage run --source=resource,utils,db,decorator -m unittest discover && coverage html
npm is required
$ sudo apt install npm -y
To run the PyCQA/prospector use the command below.
$ npm install prospector
$ prospector -i venv/ --no-autodetect
To run the PyCQA/bandit use the command below.
$ sudo apt install bandit
$ bandit -r . -x ./test/,./venv/