Skip to content

wazo-platform/xivo-dao

Repository files navigation

xivo-dao Build Status

xivo-dao is a library used internally by Wazo to access and modify different data sources (e.g. postgres database, provisioning database).

Creating the test database

apt-get install postgres postgresql-contrib
sudo -u postgres psql

Then:

CREATE USER asterisk WITH PASSWORD 'asterisk';
CREATE DATABASE asterisktest OWNER asterisk;
\c asterisktest
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Running unit tests

You need the test database asterisktest installed (see above).

apt-get install libpq-dev libyaml-dev python3-dev
pip install tox
tox --recreate -e py39

To execute tests slightly faster, you can avoid recreating all the tables in the database by passing CREATE_TABLES=0 on the command line

Docker

Start the database (needed only once):

docker-compose up -d db
export XIVO_TEST_DB_URL=postgresql://asterisk:proformatique@$(docker-compose port db 5432)/asterisk

Run your tests:

pytest