#!/bin/sh

set -e

export SKIP_SELENIUM_TESTS=y

tests=$(find $(python3 -c "import django_ca, os; print(os.path.dirname(django_ca.__file__))")  -type f -name "tests_*.py" ! -name tests_views_ocsp.py ! -name tests_admin_add_cert.py ! -name tests_admin_actions.py)
cp -r ca/ca docs ${AUTOPKGTEST_TMP}
cd ${AUTOPKGTEST_TMP}
ln -s docs/source/django_ca_sphinx .
for p in $(py3versions -s); do
  $p -m pytest --ds=ca.test_settings -k "not test_permission_denied and not test_create_cadir_permission_denied" ${tests}
done
