Load several fixtures when tesing

This patch makes it possible to load several fixtures
into nailgun database before starting tests.
One can use NAILGUN_FIXTURE_FILES variable.
It is to be a space separated list of files that
are then to be used together with 'manage.py loaddata'
command.

Change-Id: I483399b57d065934aea1118040da378988d89e9d
Closes-Bug: #1540421
This commit is contained in:
Vladimir Kozhukalov 2016-02-01 18:09:53 +03:00
parent 7efcae124a
commit f5a728c8ad
2 changed files with 5 additions and 4 deletions

View File

@ -67,8 +67,10 @@ EOL
prepare_server() {
python ${NAILGUN_ROOT}/manage.py syncdb > /dev/null
python ${NAILGUN_ROOT}/manage.py loaddefault > /dev/null
if test "$NAILGUN_SAMPLE_LOAD" = "yes"; then
python ${NAILGUN_ROOT}/manage.py loaddata $NAILGUN_SAMPLE_FILE > /dev/null
if test -n "$NAILGUN_FIXTURE_FILES"; then
for nailgun_fixture_file in $NAILGUN_FIXTURE_FILES; do
python ${NAILGUN_ROOT}/manage.py loaddata $nailgun_fixture_file > /dev/null
done
fi
python ${NAILGUN_ROOT}/manage.py run \

View File

@ -23,8 +23,7 @@ setenv =
NAILGUN_ROOT={toxinidir}/nailgun
NAILGUN_STATIC={toxinidir}/nailgun/static
NAILGUN_TEMPLATES={toxinidir}/nailgun/static
NAILGUN_SAMPLE_FILE={toxinidir}/nailgun/nailgun/fixtures/sample_environment.json
NAILGUN_SAMPLE_LOAD=no
NAILGUN_FIXTURE_FILES={env:NAILGUN_FIXTURE_FILES:}
NAILGUN_CONFIG={[base]ARTS}/test.yaml
NAILGUN_LOGS={[base]ARTS}