Skip to content
Dmitry Romanov edited this page Aug 4, 2017 · 11 revisions

Setup unit tests

Unit tests look for two environment variables:

  1. CCDB_TEST_MYSQL_CONNECTION
    if not found mysql://[email protected]:3306/test_ccdb is used
  2. CCDB_TEST_SQLITE_CONNECTION
    if not found sqlite:///$CCDB_HOME/sql/ccdb.sqlite is used

It is assumed that for unit tests on MySQL database, the schema with name ccdb_test and a user with name ccdb_user are used.

To create a user

mysql -u root -p -e "CREATE USER ccdb_user;"

To give a permission for the user

mysql -u root -p -e "GRANT ALL PRIVILEGES ON ccdb_test.* TO 'ccdb_user'@'localhost';"

There is a helpful script that allows to re/create the test database contents

> python $CCDB_HOME/python/tests/helper.py --rmysql